Opened 10 years ago

Closed 10 years ago

#22348 closed Uncategorized (needsinfo)

templates that extend admin/change_form throw difficult-to-track error

Reported by: django@… Owned by: nobody
Component: Template system Version: 1.6
Severity: Normal Keywords: template extends admin change_form
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following template runs fine;

{% extends "admin/change_form.html" %}
{% block breadcrumbs %}
{% endblock %}

{% block content %}
Blah
{% endblock %}

However omitting the breadcrumbs block should be valid - you will just get the breadcrumbs block from the parent;

{% extends "admin/change_form.html" %}

{% block content %}
Blah
{% endblock %}

however this throws a difficult to trace error;

NoReverseMatch at /admin/membership/reports/company/membershippaid/
Reverse for 'app_list' with arguments '()' and keyword arguments '{u'app_label': }' not found. 1 pattern(s) tried: [u'admin/(?P<app_label>
w+)/$']

The admin/change_form.html template contains this;
{% url 'admin:app_list' app_label=opts.app_label %}
which i think is the code generating the error due to opts being empty.

It is possible that my system (upgraded from 1.2.3) is causing opts to be blank - not sure how to test this, however putting [{{ opts }}] into the template shows that opts is empty.

Change History (1)

comment:1 by Tim Graham, 10 years ago

Resolution: needsinfo
Status: newclosed

Is /admin/membership/reports/company/membershippaid/ a custom admin view that doesn't put opts in the context? This doesn't look like in bug in Django to me. Please use our support channels and reopen the ticket if you can provide more details.

https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels

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