Answer the question
In order to leave comments, you need to log in
How to output template tag with if?
@register.inclusion_tag('html_tags/callbacktags/count_callbaks.html')
def count_callbacks():
data = CallBacks.objects.filter(read=False).count()
return {'data': data }
{% if count_callbacks != 0 %}
Count = {% count_callbacks %}
{% endif %}
Answer the question
In order to leave comments, you need to log in
Answer: ( Here )
Register the tag as assignment_tag
@register.assigment_tag
def count_callbacks():
data = CallBacks.objects.filter(read=False).count()
return {'data': data }
{% count_callbacks as cc%}
{% if cc.data != 0 %}
Count = {{ cc.data }}
{% endif %}
{% count_callbacks as cc %}
{% if cc.data != 0 %}
Count = {{ cc.data }}
{% endif %}
> The error is clear. If I go with the administrator, then it can be bypassed.
It's not clear to me. By default, programs launched by the user have the right to write to his ~. And from the root, all the more such problems should not be.
> The question is, what is the /home/user/.npm folder for?
There will be a cache and global (delivered with -g) modules will be placed there.
> Simply if it is necessary, then I need other users to have access to it
Hmm, why?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question