Opened 16 years ago

Closed 15 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: dev
Severity: Keywords: exception, ViewDoesNotExists, url
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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 by Philippe Raoult, 16 years ago

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 by Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

comment:3 by russ, 15 years ago

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