#29718 closed Cleanup/optimization (fixed)
Document admin template collision backwards incompatibility in Django 2.1
Description ¶
I have a cupido.Device
Model and a corresponding ModelAdmin with a custom view that renders a template called admin/cupido/device/search_form.html
.
After upgrading to Django 2.1, the changelist view crashes with a very confusing error:
NoReverseMatch at /admin/cupido/device/ Reverse for 'app_list' with keyword arguments '{'app_label': ''}' not found. 1 pattern(s) tried: ['admin\\/(?P<app_label>auth|cupido)/$']
This is because Django now supports overriding admin/<app_label>/<model_name>/search_form.html
and picks up my template, which breaks because it was written for a completely different purpose. This pitfall — the risk of collision with preexisting templates — could be mentioned in the 2.1 release notes.
Furthermore, the debug view doesn't identify the correct line. It says there's an error at line 11 (see attachment) but I couldn't identify any template in which a line 11 contains a {% url ... %}
tag that could result in this error. I have no idea what's happening there; I couldn't put together a good bug report for that problem.
Change History (5)
by , 7 years ago
Attachment: | Capture d’écran 2018-08-28 à 14.04.32.png added |
---|
comment:1 by , 7 years ago
Component: | contrib.admin → Documentation |
---|---|
Has patch: | set |
Summary: | Small backwards-incompatibility in Django 2.1 → Document admin template collision backwards incompatibility in Django 2.1 |
Triage Stage: | Unreviewed → Accepted |
PR