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

Fixed name clash with Article.content field #460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions aldryn_newsblog/cms_wizards.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CreateNewsBlogArticleForm(BaseFormMixin, TranslatableModelForm):
TranslatableModelForm
"""

content = forms.CharField(
article_content = forms.CharField(
label=_('Content'),
required=False,
widget=TextEditorWidget,
Expand All @@ -76,7 +76,7 @@ class CreateNewsBlogArticleForm(BaseFormMixin, TranslatableModelForm):

class Meta:
model = Article
fields = ['title', 'app_config', 'content']
fields = ['title', 'app_config', 'article_content']
# The natural widget for app_config is meant for normal Admin views and
# contains JS to refresh the page on change. This is not wanted here.
widgets = {'app_config': forms.Select()}
Expand All @@ -97,10 +97,10 @@ def save(self, commit=True):
# Set owner to current user
article.owner = self.user

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

# If the article has not been saved, then there will be no
Expand All @@ -114,7 +114,7 @@ def save(self, commit=True):
placeholder=article.content,
plugin_type='TextPlugin',
language=self.language_code,
body=content,
body=article_content,
)

with transaction.atomic():
Expand Down