#19661 closed Bug (invalid)
admin_urlname does not work as advertised
| Reported by: | 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 , 13 years ago
comment:2 by , 13 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 , 13 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
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 , 13 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.
Does your template include
{% load admin_urls %}towards the top?