12👍
✅
Since the order of evaluation is the following:
- or
- and
- not
you can omit the parenthesis:
{% if not owner.home_number or owner.work_number or owner.mobile_number %}
No contact number available
{% endif %}
Or, just FYI, you can also reverse the check:
{% if owner.home_number or owner.work_number or owner.mobile_number %}
{% else %}
No contact number available
{% endif %}
0👍
(
not a valid syntax here.
If you want to convert: if is_admin and (requested or exempted)
you could use something like:
{% if is_admin and requested or is_admin and exempted %}
- Difference between UniqueConstraint vs unique_together – Django 2.2?
- Django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited
- Upload an image from Django shell
- Django – Can I alter construction of field defined in abstract base model for specific child model?
- Django OAuth Toolkit – Register a user
Source:stackexchange.com