Opened 4 years ago

Closed 4 years ago

#17484 closed Bug (worksforme)

DetailView crashes w/ TemplateDoesNotExist("No template names provided") where ListView doesn't

Reported by: darkpixel Owned by: nobody
Component: Generic views Version: 1.4-alpha-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This appears to be a bug:

From urls.py:

    url(r'^$', PermitListView.as_view(), name='permits'),
    url(r'^(?P<pk>\d+)/$', PermitView.as_view(), name='permit'),

From views.py

class PermitListView(ListView):
    queryset = Permit.objects.all()

class PermitView(DetailView):
    queryset = Permit.objects.all()

When accessing the page that triggers the ListView object, Django looks for 'permits/permits_list.html'.

When accessing the page that triggers the DetailView object, Django crashes outputting "A server error occurred. Please contact the administrator." to the browser and this traceback: http://dpaste.com/679783/

If I change the PermitView to this:

class PermitView(DetailView):
    model = Permit

Django looks for 'permits/permit_detail.html' as it should.

Change History (1)

comment:1 Changed 4 years ago by darkpixel

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

Disregard, I started a new project and am unable to duplicate the issue in the new project.

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