shuup.simple_cms package
Subpackages
Submodules
shuup.simple_cms.layout module
- class shuup.simple_cms.layout.PageLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- identifier = 'simple-cms-page-layout'
- help_text = 'Content in this placeholder is shown for this page only.'
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- is_valid_context(context)[source]
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Whether the current context is valid for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
shuup.simple_cms.models module
- class shuup.simple_cms.models.PageOpenGraphType(value)[source]
Bases:
Enum
- Website = 'website'
- Article = 'article'
- class shuup.simple_cms.models.PageQuerySet(*args, **kwargs)[source]
Bases:
TranslatableQuerySet
- visible(shop, dt=None, user=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, shop, supplier, available_from, available_to, created_by, modified_by, created_on, modified_on, identifier, visible_in_menu, parent, list_children_on_page, show_child_timestamps, deleted, template_name, render_title)[source]
Bases:
MPTTModel
,TranslatableModel
- shop
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- supplier
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- available_from
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- available_to
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- available_permission_groups
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- created_by
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- modified_by
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_on
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- modified_on
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- identifier
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- parent
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- list_children_on_page
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- show_child_timestamps
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- translations
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- template_name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- render_title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.TreeManagerFromPageQuerySet object>
- delete(using=None)[source]
Calling
delete
on a node will delete it as well as its full subtree, as opposed to reattaching all the subnodes to its parent node.There are no argument specific to a MPTT model, all the arguments will be passed directly to the django’s
Model.delete
.delete
will not return anything.
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- save(*args, **kwargs)[source]
If this is a new node, sets tree fields up before it is inserted into the database, making room in the tree structure as necessary, defaulting to making the new node the last child of its parent.
It the node’s left and right edge indicators already been set, we take this as indication that the node has already been set up for insertion, so its tree fields are left untouched.
If this is an existing node and its parent has been changed, performs reparenting in the tree structure, defaulting to making the node the last child of its new parent.
In either case, if the node’s class has its
order_insertion_by
tree option set, the node will be inserted or moved to the appropriate position to maintain ordering by the specified field.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- add_log_entry(message, identifier=None, kind=LogEntryKind.OTHER, user=None, extra=None, save=True)
- children
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- consent_settings
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- content
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- created_by_id
- gdprsettings_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- gdpruserconsentdocument_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
- get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
- get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
- get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- level
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- lft
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- log_entries
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- modified_by_id
- open_graph
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- parent_id
- rght
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- shop_id
- supplier_id
- title
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- tree_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- url
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- class shuup.simple_cms.models.PageOpenGraph(*args, **kwargs)[source]
Bases:
TranslatableModel
Object that describes Open Graph extra meta attributes.
- page
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- image
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- og_type
- translations
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- article_author
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- description
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- get_og_type_display(*, field=<enumfields.fields.EnumField: og_type>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- image_id
- page_id
- section
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- tags
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- title
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- class shuup.simple_cms.models.PageLogEntry(id, created_on, user, message, identifier, kind, extra, target)
Bases:
BaseLogEntry
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- get_kind_display(*, field=<enumfields.fields.EnumIntegerField: kind>)
- get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
- get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- kind
- objects = <django.db.models.manager.Manager object>
- target
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- target_id
- user
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- class shuup.simple_cms.models.PageOpenGraphTranslation(id, language_code, title, description, section, tags, article_author, master)
Bases:
TranslatedFieldsModel
- exception DoesNotExist
Bases:
TranslationDoesNotExist
,DoesNotExist
,DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- article_author
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_language_code_display(*, field=<parler.utils.compat.HideChoicesCharField: language_code>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- master
The mandatory Foreign key field to the shared model.
- master_id
- objects = <django.db.models.manager.Manager object>
- section
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- tags
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class shuup.simple_cms.models.PageTranslation(id, language_code, title, url, content, master)
Bases:
TranslatedFieldsModel
- exception DoesNotExist
Bases:
TranslationDoesNotExist
,DoesNotExist
,DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- content
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_language_code_display(*, field=<parler.utils.compat.HideChoicesCharField: language_code>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- master
The mandatory Foreign key field to the shared model.
- master_id
- objects = <django.db.models.manager.Manager object>
- title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- url
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
shuup.simple_cms.plugins module
- class shuup.simple_cms.plugins.OrderedModelMultipleChoiceField(queryset, required=True, widget=None, label=None, initial=None, help_text='', *args, **kwargs)[source]
Bases:
ModelMultipleChoiceField
- class shuup.simple_cms.plugins.PageLinksConfigForm(**kwargs)[source]
Bases:
GenericPluginForm
A configuration for the PageLinksPlugin
- clean()[source]
A custom clean method to save page configuration information in a serializable form
- base_fields = {}
- declared_fields = {}
- property media
Return all media required to render the widgets on this form.
- class shuup.simple_cms.plugins.PageLinksPlugin(config)[source]
Bases:
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 = 'CMS Page Links'
- template_name = 'shuup/simple_cms/plugins/page_links.jinja'
- cacheable = True
- editor_form_class
alias of
PageLinksConfigForm
- fields = [('title', <shuup.xtheme.plugins.forms.TranslatableField object>), ('show_all_pages', <django.forms.fields.BooleanField object>), ('hide_expired', <django.forms.fields.BooleanField object>), 'pages']
shuup.simple_cms.settings module
- shuup.simple_cms.settings.SHUUP_SIMPLE_CMS_DEFAULT_TEMPLATE = 'shuup/simple_cms/page.jinja'
Defines the default and fallback template to be used when rendering CMS pages
shuup.simple_cms.template_helpers module
shuup.simple_cms.templates module
shuup.simple_cms.urls module
shuup.simple_cms.utils module
shuup.simple_cms.views module
- class shuup.simple_cms.views.PageView(**kwargs)[source]
Bases:
DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- 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 would.No 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.
- get_template_names()[source]
Return a list of template names to be used for the request. May not be called if render_to_response() is overridden. Return the following list:
the value of
template_name
on the view (if provided)the contents of the
template_name_field
field on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
Module contents
- class shuup.simple_cms.AppConfig(*args, **kwargs)[source]
Bases:
AppConfig
- name = 'shuup.simple_cms'
- verbose_name = 'Content Pages'
- label = 'shuup_simple_cms'
- default_auto_field = 'django.db.models.BigAutoField'
- provides = {'admin_module': ['shuup.simple_cms.admin_module:SimpleCMSAdminModule'], 'admin_page_form_part': ['shuup.simple_cms.admin_module.form_parts:CMSOpenGraphFormPart'], 'front_template_helper_namespace': ['shuup.simple_cms.template_helpers:SimpleCMSTemplateHelpers'], 'front_urls_post': ['shuup.simple_cms.urls:urlpatterns'], 'simple_cms_template': ['shuup.simple_cms.templates:SimpleCMSDefaultTemplate', 'shuup.simple_cms.templates:SimpleCMSTemplateSidebar'], 'xtheme_layout': ['shuup.simple_cms.layout:PageLayout'], 'xtheme_plugin': ['shuup.simple_cms.plugins:PageLinksPlugin']}
See /provides for details about the
provides
variable.