Tuesday, June 2, 2020

Custom template tags - instance.templatetag

Hi! How to change my template tag?
from django import template

register = template.Library()

@register.simple_tag
def votes_up_exists(answer, user_id):
pass

how I use it - {% votes_up_exists answer request.user.id %}
how I would like to use it - {% answer.votes_up_exists user_id %}

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c0aba2c4-b13d-4ba2-9478-d32661c81307%40googlegroups.com.

No comments:

Post a Comment