#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 |
Description
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')
Change History (2)
comment:1 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
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.
This works as expected in 1.4 (and master too).
You may be missing some template dir setting?