#20042: TemplateDoesNotExist when using DetailView with no template_name
-------------------------------+--------------------
     Reporter:  anonymous      |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  Uncategorized  |    Version:  1.4
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 I get a TemplateDoesNotExist when using DetailView with no template_name:


 {{{
 myapp/mymodel_detail.html
 }}}


 In urls.py


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


 In models.py


 {{{
     class MyModelDetailView(DetailView):

         model = MyModel

         def get(self, request, *args, **kwargs):
             try:
                 self.model.objects.get(pk=kwargs['pk'])
                 return super(MyModelDetailView, self).get(request,
 **kwargs)
             except Http404:
                 render_to_response('admin/no_object.html')

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20042>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to