48👍
✅
You have an extra space which causes the error.
value="{{ value|default_if_none: '' }}"
should be
value="{{ value|default_if_none:'' }}"
0👍
With Django template filters, putting space either before or after :
gets error as shown below:
# Space (Error)
↓ ↓
value="{{ value|default_if_none : '' }}"
So, don’t put any space there not to get error as shown below:
# No space (No error)
↓ ↓
value="{{ value|default_if_none:'' }}"
In addition, putting space either before or after |
doesn’t get error:
# Space (No error)
↓ ↓
value="{{ value | default_if_none:'' }}"
- Django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)")
- Django manage.py settings default
- Django model choice not raising error for an invalid choice
Source:stackexchange.com