The Django documentation mentions in general class views that a DetailView consists of: View, SingleObjectMixin and SingleObjectTemplateResponseMixin. I am experimenting with this, since I'm interested in creating a general view that will make the object_detail view with ModelForm so that my model strings can be created automatically.
To try to duplicate a DetailView, I tried to create a class as follows:
from django.views.generic import list_detail, View from django.views.generic.detail import (SingleObjectMixin, SingleObjectTemplateResponseMixin, BaseDetailView) class formdisplay(View,SingleObjectMixin,SingleObjectTemplateResponseMixin): pass
When I use formdisplay instead of list_detail.object_detail, I get an error
TypeError at /inpatient-detail/4/ __init__() takes exactly 1 non-keyword argument (2 given)
Any hints on how to do this?
Also, where is the documentation on how to write import statements? I had to search Google to find what to import, since I could not find it in the documentation.
Thanks in advance, Steve
source share