How i can implement this condition in django template with multiple and or statement in if?
{% if ((email_setting.twitter_link is not None and email_setting.twitter_link != '')
or (email_setting.instagram_link is not None and email_setting.instagram_link != '')
or (email_setting.fb_link is not None and email_setting.fb_link!= '') ) %}
Here my body
{% endif %}
this give me an error
TemplateSyntaxError at /settings/emailView
Could not parse the remainder: '((email_setting.twitter_link' from '((email_setting.twitter_link'
You can expresss this as:
{% if email_setting.twitter_link or email_setting.instagram_link or email_setting.fb_link %}
…
{% endif %}
Here we check the truthiness of the twitter_link and other settings. The truthiness of None and the empty string are False whereas for a non-empty string, it is True.