Django url template with a filter

Anisotropic

I'm getting url reverse errors and think this line is to blame.

{% if has_change_permission %}
    <a href="{% url 'opts|admin_urlname:changelist' %}">
    {{ opts.verbose_name_plural|capfirst }}</a>
{% else %}{
    { opts.verbose_name_plural|capfirst }}
{% endif %}

Am I corect in placing the entire filter within single quotes or do I need a double quote around the changelist argument?

Tomas Walch

You shouldn't have any quotes since you're referencing a context variable and not providing a string value. The argument is still a string though so the correct line is <a href="{% url opts|admin_urlname:'changelist' %}">.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related