python - Django Class Based View Inheritance Issue -
i have 2 form classes, each of modelform of same model. 1 called projectform
, other called adminprojectform
. projectform
has number of fields excluded, adminprojectform
not.
in views, i'm using 2 classes, edit
, adminedit
. edit
uses django generic editing view of updateview
, has form_class
set projectform
. adminedit
inherits edit
, has form_class
set adminprojectedit
.
one think mean form generated adminedit
show fields excluded on edit
. part working correctly - form fields drawn fine (and not drawn on edit
. however, when submitting adminedit
form, field excluded in projectform
stripped , not saved. suggestions?
here's forms.py
:
class projectform(modelform): class meta: model = project exclude = ('field1', 'field2', 'field3', 'qualifies_for_judging', 'reason_for_disqualification', 'finalist', 'hashtag') class adminprojectform(modelform): class meta: model = project exclude = ()
and views.py:
class edit(updateview): model = project form_class = projectform class adminedit(edit): model = project form_class = adminprojectform
Comments
Post a Comment