Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#29718 closed Cleanup/optimization (fixed)

Document admin template collision backwards incompatibility in Django 2.1

Reported by: Aymeric Augustin Owned by: nobody
Component: Documentation Version: 2.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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.

Attachments (1)

Capture d’écran 2018-08-28 à 14.04.32.png (229.8 KB ) - added by Aymeric Augustin 6 years ago.

Download all attachments as: .zip

Change History (5)

by Aymeric Augustin, 6 years ago

comment:1 by Tim Graham, 6 years ago

Component: contrib.adminDocumentation
Has patch: set
Summary: Small backwards-incompatibility in Django 2.1Document admin template collision backwards incompatibility in Django 2.1
Triage Stage: UnreviewedAccepted

comment:2 by Tim Graham, 6 years ago

#28935 could be the issue about the incorrect debug page location.

comment:3 by GitHub <noreply@…>, 6 years ago

Resolution: fixed
Status: newclosed

In 166dec84:

Fixed #29718 -- Doc'd admin template collision backwards incompatibility in Django 2.1.

comment:4 by Tim Graham <timograham@…>, 6 years ago

In c4559d0b:

[2.1.x] Fixed #29718 -- Doc'd admin template collision backwards incompatibility in Django 2.1.

Backport of 166dec84069c15ecb2bc3a5590f872febdc4709c from master

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