Opened 11 years ago

Closed 9 years ago

#6192 closed (worksforme)

url or reverse raise ViewDoesNotExists but fail to properly identify which view

Reported by: alex@… Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords: exception, ViewDoesNotExists, url
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Got an unexpected error while was working with admin part.
On first call to '/admin', Django was displaying ViewDoesNotExists exception with reference to view that was included in my project's urls. Although that view truly didn't yet existed (I just put a reference to nonexistent view in order to write it later), it hadn't any relation to admin app.
The source of error was admin's template system. Especially the 'base.html', at that line:

{% url django.contrib.admin.views.doc.doc_index %}

That were strange. It took a while for me to find the reason.

I believe this is because of the way url template tag works.
It seems like it looks up in all available urls and views to calculate corresponding URL. And falls on nonexistent views.

This behaviour should be documented or (better) special exception should be raised in such case.

Change History (3)

comment:1 Changed 10 years ago by Philippe Raoult

Component: Admin interfaceCore framework
Summary: Admin raises ViewDoesNotExists without an (obvious) reasonurl or reverse raise ViewDoesNotExists but fail to properly identify which view

#6568 was complaining about a similar issue and I've been bitten by this one quite a few times. It's not really an admin issue but has to do with url/reverse.

comment:2 Changed 10 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:3 Changed 9 years ago by russ

Resolution: worksforme
Status: newclosed

This was addressed by r8272 and improved on in r8672. The error for the OP's example is now "Reverse for 'revucourses.django.contrib.admin.views.doc.doc_index' with arguments '()' and keyword arguments '{}' not found."

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