shuup.simple_cms package¶
Subpackages¶
Submodules¶
shuup.simple_cms.models module¶
-
class
shuup.simple_cms.models.
PageQuerySet
(*args, **kwargs)[source]¶ Bases:
parler.managers.TranslatableQuerySet
-
visible
(dt=None)[source]¶ Get pages that should be publicly visible.
This does not do permission checking.
Parameters: dt (datetime.datetime) – Datetime for visibility check Returns: QuerySet of pages. Return type: QuerySet[Page]
-
-
class
shuup.simple_cms.models.
Page
(id, available_from, available_to, created_by, modified_by, created_on, modified_on, identifier, visible_in_menu, parent, list_children_on_page)[source]¶ Bases:
mptt.models.MPTTModel
,parler.models.TranslatableModel
Parameters: - id (AutoField) – Id
- available_from (DateTimeField) – Set an available from date to restrict the page to be available only after a certain date and time. This is useful for pages describing sales campaigns or other time-sensitive pages.
- available_to (DateTimeField) – Set an available to date to restrict the page to be available only after a certain date and time. This is useful for pages describing sales campaigns or other time-sensitive pages.
- created_by (ForeignKey to
django.contrib.auth.models.User
) – Created by - modified_by (ForeignKey to
django.contrib.auth.models.User
) – Modified by - created_on (DateTimeField) – Created on
- modified_on (DateTimeField) – Modified on
- identifier (InternalIdentifierField) – This identifier can be used in templates to create URLs
- visible_in_menu (BooleanField) – Check this if this page should have a link in the top menu of the store front.
- parent (TreeForeignKey to
shuup.simple_cms.models.Page
) – Set this to a parent page if this page should be subcategorized under another page. - list_children_on_page (BooleanField) – Check this if this page should list its children pages.
- lft (PositiveIntegerField) – Lft
- rght (PositiveIntegerField) – Rght
- tree_id (PositiveIntegerField) – Tree id
- level (PositiveIntegerField) – Level
- title (CharField) – (Translatable) The page title. This is shown anywhere links to your page are shown.
- url (CharField) – (Translatable) The page url. Choose a descriptive url so that search engines can rank your page higher. Often the best url is simply the page title with spaces replaced with dashes.
- content (TextField) – (Translatable) The page content. This is the text that is displayed when customers click on your page link.
-
translations
¶ ManyToOneRel to
shuup.simple_cms.models.PageTranslation
-
children
¶ ManyToOneRel to
shuup.simple_cms.models.Page
-
created_by
¶
-
modified_by
¶
-
parent
¶
-
translations
-
objects
= <django.db.models.manager.TreeManagerFromPageQuerySet object>¶
-
exception
DoesNotExist
¶
-
exception
Page.
MultipleObjectsReturned
¶
-
Page.
children
-
Page.
content
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Page.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Page.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Page.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Page.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Page.
title
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Page.
url
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
class
shuup.simple_cms.models.
PageTranslation
(id, language_code, title, url, content, master)¶ Bases:
parler.models.TranslatedFieldsModel
Parameters: - id (AutoField) – Id
- language_code (HideChoicesCharField) – Language
- title (CharField) – The page title. This is shown anywhere links to your page are shown.
- url (CharField) – The page url. Choose a descriptive url so that search engines can rank your page higher. Often the best url is simply the page title with spaces replaced with dashes.
- content (TextField) – The page content. This is the text that is displayed when customers click on your page link.
- master (ForeignKey to
shuup.simple_cms.models.Page
) – Master
-
exception
DoesNotExist
¶ Bases:
parler.models.TranslationDoesNotExist
,shuup.simple_cms.models.DoesNotExist
,shuup.simple_cms.models.DoesNotExist
-
exception
PageTranslation.
MultipleObjectsReturned
¶
-
PageTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
PageTranslation.
master
¶
-
PageTranslation.
objects
= <django.db.models.manager.Manager object>¶
shuup.simple_cms.plugins module¶
-
class
shuup.simple_cms.plugins.
PageLinksConfigForm
(**kwargs)[source]¶ Bases:
shuup.xtheme.plugins.forms.GenericPluginForm
A configuration for the PageLinksPlugin
-
clean
()[source]¶ A custom clean method to save page configuration information in a serializable form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shuup.simple_cms.plugins.
PageLinksPlugin
(config)[source]¶ Bases:
shuup.xtheme.TemplatedPlugin
A plugin for displaying links to visible CMS pages in the shop front
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'simple_cms.page_links'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shuup/simple_cms/plugins/page_links.jinja'¶
-
editor_form_class
¶ alias of
PageLinksConfigForm
-
fields
= [('title', <shuup.xtheme.plugins.forms.TranslatableField object at 0x7fabc7610208>), ('show_all_pages', <django.forms.fields.BooleanField object at 0x7fabc76109e8>), ('hide_expired', <django.forms.fields.BooleanField object at 0x7fabc7dc6fd0>), 'pages']¶
-
shuup.simple_cms.template_helpers module¶
shuup.simple_cms.urls module¶
shuup.simple_cms.views module¶
-
class
shuup.simple_cms.views.
PageView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Page
-
slug_field
= 'translations__url'¶
-
slug_url_kwarg
= 'url'¶
-
template_name
= 'shuup/simple_cms/page.jinja'¶
-
context_object_name
= 'page'¶
-
get
(request, *args, **kwargs)[source]¶ Override normal get method to return correct page based on the active language and slug
- Cases:
Page is not found:
raise Http404()
like django wouldNo translation in active language for the page:
raise Http404()
- Translation was found for active language, but the url doesn’t match given url:
return HttpResponseRedirect
to the active languages url
If none of the upper matches: render page normally
-
Module contents¶
-
class
shuup.simple_cms.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shuup.apps.AppConfig
-
name
= 'shuup.simple_cms'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= 'shuup_simple_cms'¶
-
provides
= {'front_urls_post': ['shuup.simple_cms.urls:urlpatterns'], 'xtheme_plugin': ['shuup.simple_cms.plugins:PageLinksPlugin'], 'front_template_helper_namespace': ['shuup.simple_cms.template_helpers:SimpleCMSTemplateHelpers'], 'admin_module': ['shuup.simple_cms.admin_module:SimpleCMSAdminModule']}¶
-