Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using form inheritance on Page releated model forms.

  • Loading branch information...
commit e8a7b3f89acae9a9db14a388e991fe567d1c4aeb 1 parent 9d2c4eb
@zuzelvp zuzelvp authored
Showing with 15 additions and 18 deletions.
  1. +15 −18 lernanta/apps/content/forms.py
View
33 lernanta/apps/content/forms.py
@@ -8,20 +8,6 @@
from content.models import Page
-class PageForm(forms.ModelForm):
-
- class Meta:
- model = Page
- fields = ('title', 'sub_header', 'content', 'minor_update',)
-
-
-class NotListedPageForm(forms.ModelForm):
-
- class Meta:
- model = Page
- fields = ('content', 'sub_header', 'minor_update',)
-
-
class OwnersPageForm(forms.ModelForm):
class Meta:
@@ -36,11 +22,22 @@ def clean_title(self):
return data
-class OwnersNotListedPageForm(forms.ModelForm):
+class PageForm(OwnersPageForm):
- class Meta:
- model = Page
- fields = ('content', 'sub_header', 'collaborative', 'minor_update')
+ class Meta(OwnersPageForm.Meta):
+ exclude = ('collaborative',)
+
+
+class NotListedPageForm(OwnersPageForm):
+
+ class Meta(OwnersPageForm.Meta):
+ exclude = ('title', 'collaborative',)
+
+
+class OwnersNotListedPageForm(OwnersPageForm):
+
+ class Meta(OwnersPageForm.Meta):
+ exclude = ('title',)
class TaskLinkSubmitForm(forms.ModelForm):
Please sign in to comment.
Something went wrong with that request. Please try again.