Code

Opened 6 years ago

Closed 5 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:

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.

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by PhiR

  • Component changed from Admin interface to Core framework
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Admin raises ViewDoesNotExists without an (obvious) reason to url 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 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by russ

  • Resolution set to worksforme
  • Status changed from new to closed

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."

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.