Commit 53205aca by benjaoming

fix setting article fk on reusable plugins for identifying permissions

parent 7e6da88b
...@@ -13,7 +13,7 @@ WIKI_LANGUAGE = 'markdown' ...@@ -13,7 +13,7 @@ WIKI_LANGUAGE = 'markdown'
# extend the built-in editor and customize it.... # extend the built-in editor and customize it....
EDITOR = getattr( django_settings, 'WIKI_EDITOR', 'wiki.editors.markitup.MarkItUp' ) EDITOR = getattr( django_settings, 'WIKI_EDITOR', 'wiki.editors.markitup.MarkItUp' )
MARKDOWN_KWARGS = {'extensions': ['footnotes', 'headerid', 'extra', 'toc'], 'safe_mode': 'replace'} MARKDOWN_KWARGS = {'extensions': ['headerid', 'extra', 'toc'], 'safe_mode': 'replace'}
MARKDOWN_KWARGS.update(getattr( django_settings, 'WIKI_MARKDOWN_KWARGS', {} )) MARKDOWN_KWARGS.update(getattr( django_settings, 'WIKI_MARKDOWN_KWARGS', {} ))
# This slug is used in URLPath if an article has been deleted. The children of the # This slug is used in URLPath if an article has been deleted. The children of the
......
...@@ -97,7 +97,7 @@ class ReusablePlugin(ArticlePlugin): ...@@ -97,7 +97,7 @@ class ReusablePlugin(ArticlePlugin):
# Automatically make the original article the first one in the added set # Automatically make the original article the first one in the added set
if not self.article: if not self.article:
articles = self.articles.all() articles = self.articles.all()
if articles.count() == 0: if articles.exists():
self.article = articles[0] self.article = articles[0]
super(ReusablePlugin, self).save(*args, **kwargs) super(ReusablePlugin, self).save(*args, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment