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 <[email protected]
>:

> 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/CAK4qSCfQAqKnTTQeYaK-5awmjK97d8jtO2O8Vgp97uQkBbfzpQ%40mail.gmail.com.

Reply via email to