1π
β
It is very sad but you cant pass params to methods from templates(indeed this is a good idea β so you donβt mix presentation logic with model logic, almost π ). You have to write a template tag for this purpose.
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/
tag would look like this(not tested):
@register.simple_tag(takes_context=True) # assuming you are running in request context
def current_user_is_creator(context,article):
user = context['request'].user
return article.creator.user == user # dont forget to add proper checks
Or you could prepare required data in the view.
π€singer
Source:stackexchange.com