Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19661 closed Bug (invalid)

admin_urlname does not work as advertised

Reported by: david.reitter@… Owned by: nobody
Component: Uncategorized Version: dev
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

Description

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

{% url opts|admin_urlname: 'delete' a.pk %}

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:

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls

Change History (5)

comment:1 by Aymeric Augustin, 12 years ago

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

comment:2 by anonymous, 12 years ago

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/admin_urls.py in admin_urlname, line 9

comment:3 by Claude Paroz, 12 years ago

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 by Diederik van der Boor, 12 years ago

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 by david.reitter@…, 12 years ago

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

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