Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Merge pull request #335 from aldryn/mkoistinen/add_richtext_field_to_…
Browse files Browse the repository at this point in the history
…wizards

Uses a rich-text editor for the Content field in the wizard
  • Loading branch information
mkoistinen committed Dec 29, 2015
2 parents 521bcd0 + 3d552bb commit 0006853
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions aldryn_newsblog/cms_wizards.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from cms.wizards.wizard_base import Wizard
from cms.wizards.forms import BaseFormMixin

from djangocms_text_ckeditor.widgets import TextEditorWidget
from djangocms_text_ckeditor.html import clean_html
from parler.forms import TranslatableModelForm

from .cms_appconfig import NewsBlogConfig
Expand Down Expand Up @@ -64,9 +66,9 @@ class CreateNewsBlogArticleForm(BaseFormMixin, TranslatableModelForm):
"""

content = forms.CharField(
label="Content", help_text=_("Optional. If provided, will be added to "
"the main body of the article."),
required=False, widget=forms.Textarea())
label="Content", required=False, widget=TextEditorWidget,
help_text=_("Optional. If provided, will be added to the main body of "
"the article."))

class Meta:
model = Article
Expand All @@ -90,7 +92,7 @@ def save(self, commit=True):

# If 'content' field has value, create a TextPlugin with same and add
# it to the PlaceholderField
content = self.cleaned_data.get('content', '')
content = clean_html(self.cleaned_data.get('content', ''), False)
if content and permissions.has_plugin_permission(
self.user, 'TextPlugin', 'add'):

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'backport_collections==0.1',
'django-appdata>=0.1.4',
'django-cms>=3.0.12',
'djangocms-text-ckeditor',
'django-filer>=0.9.9',
'django-parler>=1.4',
'django-reversion>=1.8.2,<1.9',
Expand Down

0 comments on commit 0006853

Please sign in to comment.