The Django documentation mentions in the Class-based generic views that the DetailView is composed from: View, SingleObjectMixin, and SingleObjectTemplateResponseMixin. I am experimenting with this, as I am interested in creating a generic view that will do an object_detail view with a ModelForm so that my model rows can be generated automatically.
To try to duplicate the 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 the error
TypeError at /inpatient-detail/4/
__init__() takes exactly 1 non-keyword argument (2 given)
Any hints at how to do this?
Also, where is the documentation on how to write the import statements? I had to google to find what to import from as I couldn't find that in the documentation.
Thanks in advance, Steve