-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathforms.py
56 lines (44 loc) · 1.72 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from django import forms
from rewrite.models import RewriteWebsite, RewriteTemplate, RewriteSection, RewriteBlog, RewritePage, RewriteBlogPost
class RewriteWebsiteForm(forms.ModelForm):
class Meta:
model = RewriteWebsite
fields = ( "domain", "blog_enabled",)
class RewriteSectionForm(forms.ModelForm):
class Meta:
model = RewriteSection
fields = ("name", )
class RewriteTemplateForm(forms.ModelForm):
class Meta:
model = RewriteTemplate
fields = ("name", "show_main_nav", "show_section_nav",
"extra_head_html", "page_header_html",
"pre_content_html", "post_content_html",
)
class RewriteNewTemplateForm(forms.ModelForm):
class Meta:
model = RewriteTemplate
fields = ("name",)
class RewriteBlogForm(forms.ModelForm):
class Meta:
model = RewriteBlog
fields = ("template", )
class RewriteNewPageForm(forms.ModelForm):
class Meta:
model = RewritePage
fields = ("title", "section", "template",)
def __init__(self, *args, **kwargs):
super(RewriteNewPageForm,self).__init__(*args,**kwargs)
self.fields["template"].choices = [f for f in self.fields["template"].choices][1:]
class RewritePageForm(RewriteNewPageForm):
class Meta:
model = RewritePage
fields = ("title", "section", "nav_link_name", "description", "keywords", "template", "is_published")
class RewriteBlogPostForm(forms.ModelForm):
class Meta:
model = RewriteBlogPost
fields = ("title", "description", "keywords", "is_published")
class RewriteNewBlogPostForm(forms.ModelForm):
class Meta:
model = RewriteBlogPost
fields = ("title", )