diff --git a/markupwiki/forms.py b/markupwiki/forms.py index 790c57a..8918264 100644 --- a/markupwiki/forms.py +++ b/markupwiki/forms.py @@ -1,10 +1,15 @@ +from django.conf import settings from django import forms from markupwiki.models import Article, ArticleVersion +MARKUP_TYPE_EDITABLE = getattr(settings, 'MARKUPWIKI_MARKUP_TYPE_EDITABLE', False) + class ArticleForm(forms.ModelForm): class Meta: model = ArticleVersion - fields = ['body', 'body_markup_type'] + fields = ['body'] + if MARKUP_TYPE_EDITABLE: + fields.append('body_markup_type') class StaffModerationForm(forms.ModelForm): class Meta: diff --git a/markupwiki/models.py b/markupwiki/models.py index 762761e..a188387 100644 --- a/markupwiki/models.py +++ b/markupwiki/models.py @@ -1,8 +1,11 @@ from django.db import models +from django.conf import settings from django.contrib.auth.models import User from django.core.urlresolvers import reverse from markupfield.fields import MarkupField +DEFAULT_MARKUP_TYPE = getattr(settings, 'MARKUPWIKI_DEFAULT_MARKUP_TYPE', 'plain') + PUBLIC, LOCKED, DELETED = range(3) ARTICLE_STATUSES = ( (PUBLIC, 'Public'), # public - no restrictions on viewing/editing @@ -43,7 +46,7 @@ class ArticleVersion(models.Model): number = models.PositiveIntegerField() timestamp = models.DateTimeField(auto_now_add=True) removed = models.BooleanField(default=False) - body = MarkupField() + body = MarkupField(default_markup_type=DEFAULT_MARKUP_TYPE) class Meta: ordering = ['timestamp']