Sorry - I posted that without a link?
https://stackoverflow.com/questions/1333189/django-template-system-calling-a-function-inside-a-model
This is by design - and you should always try to simplify what you are doing in django templates.
Regards,
Andréas
Den ons 3 juni 2020 kl 11:41 skrev Andréas Kühne <andreas.kuhne@hypercode.se>:
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éasDen tis 2 juni 2020 kl 22:53 skrev Jan Gregorczyk <jnk.gregorczyk@gmail.com>:--Hi! How to change my template tag?from django import templateregister = template.Library()@register.simple_tagdef votes_up_exists(answer, user_id):passhow 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.
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/CAK4qSCfQAqKnTTQeYaK-5awmjK97d8jtO2O8Vgp97uQkBbfzpQ%40mail.gmail.com.
No comments:
Post a Comment