Could someone help me to find the correct way to construct the template in django.
If the view object is edited by moderator (user is not owner) I put into context an object that has permissions as attributes. For example, object.permission_profile is boolean field that allows to edit user-owner profile.
So, in template I suggest I need to use if-statement to put necessary url, one url – when both object exists and permission is True, and another url – if object is not in context.
I put into template if-statement such way
{% if object %} {% if object.permission %} url-1 {% endif %} {% else %} url-2 {% endif %}
Is this correct way?
Or is there another right or faster rule to use it?
Thank you!
1