Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#20042 closed Bug (invalid)

TemplateDoesNotExist when using DetailView with no template_name

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: 1.4
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


I get a TemplateDoesNotExist when using DetailView with no template_name:



    url(r'^admin/<myapp>/<mymodel>/(?P<pk>\d+)/$', views.MyModelDetailView.as_view(), name='mymodel_detail'),
    url(r'^admin/', include(,


    class MyModelDetailView(DetailView):

        model = MyModel

        def get(self, request, *args, **kwargs):
                return super(MyModelDetailView, self).get(request, **kwargs)
            except Http404:

Change History (2)

comment:1 Changed 6 years ago by matiasb

Resolution: invalid
Status: newclosed

This works as expected in 1.4 (and master too).
You may be missing some template dir setting?

comment:2 Changed 6 years ago by anonymous

I don't want to set any template. I want the default view/template when returning

super(MyModelDetailView, self).get(request, **kwargs)

. Is the template attribute required? I don't see any in the doc .

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