2019-03-27 15:49:14 +00:00
|
|
|
from django import forms
|
2019-08-23 15:19:40 +00:00
|
|
|
from .models import Page, Section, SubSection
|
2019-03-27 15:49:14 +00:00
|
|
|
|
|
|
|
class PageForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Page
|
|
|
|
fields = '__all__'
|
|
|
|
|
2019-08-23 15:19:40 +00:00
|
|
|
class SectionForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Section
|
|
|
|
exclude = ['page']
|
|
|
|
|
|
|
|
class SubSectionForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = SubSection
|
|
|
|
exclude = ['section']
|
|
|
|
|
|
|
|
SectionFormSet = forms.inlineformset_factory(Page, Section, exclude='__all__', extra=0)
|
|
|
|
SubSectionFormSet = forms.inlineformset_factory(Section, SubSection, exclude='__all__', extra=0)
|