django-markupwiki/markupwiki/forms.py

22 lines
610 B
Python
Raw Normal View History

2010-03-30 20:17:42 +00:00
from django.conf import settings
2010-03-30 14:43:30 +00:00
from django import forms
from markupwiki.models import Article, ArticleVersion
2010-03-30 14:43:30 +00:00
2010-03-31 16:02:07 +00:00
MARKUP_TYPE_EDITABLE = getattr(settings, 'MARKUPWIKI_MARKUP_TYPE_EDITABLE', True)
2010-03-30 20:17:42 +00:00
2010-03-30 14:43:30 +00:00
class ArticleForm(forms.ModelForm):
class Meta:
model = ArticleVersion
2010-03-31 16:02:07 +00:00
fields = ['body', 'comment']
2010-03-30 20:17:42 +00:00
if MARKUP_TYPE_EDITABLE:
fields.append('body_markup_type')
2010-03-30 14:43:30 +00:00
class StaffModerationForm(forms.ModelForm):
class Meta:
model = Article
fields = ['status']
2010-04-02 17:50:49 +00:00
class ArticleRenameForm(forms.Form):
new_title = forms.CharField(label='Rename', max_length=50)