Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#19661 closed Bug (invalid)

admin_urlname does not work as advertised

Reported by: david.reitter@… Owned by: nobody
Component: Uncategorized Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This fails to work in my template (1.5rc1):

{% url opts|admin_urlname: 'delete' %}

I get "Invalid filter: 'admin_urlname'. The syntax of 'url' changed in Django 1.5, see the docs.".

I've tried different variants of quoting to comply with the syntax, but no dice.

If there is no bug, I think the documentation needs to be updated at:

Change History (5)

comment:1 Changed 6 years ago by Aymeric Augustin

Does your template include {% load admin_urls %} towards the top?

comment:2 Changed 6 years ago by anonymous

Thanks, good point. I added this, but now, this line:

<td><a href="{% url opts|admin_urlname:'add' %}/">{{e.symbol}}</a></td>

produces an error:

AttributeError at /exp/god/allassets
'str' object has no attribute 'app_label'

Exception Location: /Library/Python/2.7/site-packages/django/contrib/admin/templatetags/ in admin_urlname, line 9

comment:3 Changed 6 years ago by Claude Paroz

Resolution: invalid
Status: newclosed

I guess that opts is not of the required type. Please use support channels before reporting a bug (TicketClosingReasons/UseSupportChannels). Reopen if you can show the bug is in Django.

comment:4 Changed 6 years ago by Diederik van der Boor

Are you sure opts is a valid variable in your template?
It seems to me it got replaced by TEMPLATE_STRING_IF_INVALID

You can use the {% debug %} tag to print all content data,
or use {% print %} from django-debugtools to print the context data of your template in a formatted layout.

comment:5 Changed 6 years ago by david.reitter@…

Thanks for the pointers, and apologies for filing a spurious report.

Note: See TracTickets for help on using tickets.
Back to Top