Hi Jan,

You can't do it like that. A templatetag is a simple function that is
handled in a special way by the django templating language.

See here for an explanation:


Med vänliga hälsningar,

Andréas


Den tis 2 juni 2020 kl 22:53 skrev Jan Gregorczyk <[email protected]
>:

> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c0aba2c4-b13d-4ba2-9478-d32661c81307%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c0aba2c4-b13d-4ba2-9478-d32661c81307%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCeFTkKzn7Bcx2g0osRx%3DGA9q3pDQMNd_bFqDVowxtVyMg%40mail.gmail.com.

Reply via email to