Skip to content

Commit

Permalink
CmsPageCreator bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jedie committed Apr 27, 2017
1 parent f47d6fd commit 5bc8af9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions django_cms_tools/fixtures/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def create_page(self):
pass # Create page
else:
log.debug("Use existing plugin page: %s", page)
return page
else:
# Not a plugin page
queryset = Title.objects.filter(language=self.default_language_code)
Expand All @@ -138,6 +137,9 @@ def create_page(self):
apphook_namespace=self.apphook_namespace
)
log.debug("Page created in %s: %s", self.default_lang_name, page)
else:
# Get draft if existing page was found.
page = page.get_draft_object()
return page

def create_title(self, page):
Expand All @@ -158,9 +160,16 @@ def create_title(self, page):
else:
log.debug("Page title exist: %s", title)

def fill_content(self, page):
"""
Can be overwritten to add content to the created page
"""
pass

def create(self):
page = self.create_page() # Create page (and page title) in default language
self.create_title(page) # Create page title in all other languages
self.fill_content(page) # Add content to the created page.
self.publish(page) # Publish page in all languages

# Force to reload the url configuration.
Expand Down Expand Up @@ -291,10 +300,6 @@ def create(self):
raise plugin

page = super(CmsPluginPageCreator, self).create()

# Add a plugin with content in all languages to the created page.
self.fill_content(page)

return page


Expand Down

0 comments on commit 5bc8af9

Please sign in to comment.