Igor  Tischenko
Igor Tischenko

Reputation: 640

adding {% trans " " %} tag inside {% if .....%} tag

Base template that I have:

{% load auth_extras %}
{% if request.user|has_group:"Administrator" %}
<li><a href="/admin/"> Admin Section &nbsp;</a></li>
{% endif %}
{% if request.user|has_group:"Moderator" %}
<li><a href="/admin/">Admin Section </a></li>
{% endif %}

How to add {% trans " " %} tag to "Admin Section" in this case ??? Adding it dirrectly is restricted because I have tag in tag which is not allowed. Or will be better to ask - how to be in this case ?

Upvotes: 0

Views: 271

Answers (1)

user8060120
user8060120

Reputation:

can you use trans ... as? more details trans-template-tag

{% trans "Admin Section" as adm_section %}
{% if request.user|has_group:"Moderator" %}
<li><a href="/admin/"> {{ adm_section }}</a></li>
{% endif %}

Upvotes: 2

Related Questions