shuup.simple_cms.admin_module package

Submodules

shuup.simple_cms.admin_module.form_parts module

class shuup.simple_cms.admin_module.form_parts.CMSOpenGraphForm(*args, **kwargs)[source]

Bases: ShuupAdminForm

class Meta[source]

Bases: object

model

alias of PageOpenGraph

fields = ('og_type', 'title', 'description', 'section', 'tags', 'article_author', 'image')
__init__(*args, **kwargs)[source]
base_fields = {'article_author': <django.forms.fields.CharField object>, 'description': <django.forms.fields.CharField object>, 'image': <filer.fields.image.AdminImageFormField object>, 'og_type': <enumfields.forms.EnumChoiceField object>, 'section': <django.forms.fields.CharField object>, 'tags': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
declared_fields = {'article_author': <django.forms.fields.CharField object>, 'description': <django.forms.fields.CharField object>, 'section': <django.forms.fields.CharField object>, 'tags': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class shuup.simple_cms.admin_module.form_parts.CMSOpenGraphFormPart(request, object=None)[source]

Bases: FormPart

priority: int = 20
name = 'opengraph'
form

alias of CMSOpenGraphForm

get_form_defs()[source]
form_valid(form)[source]

shuup.simple_cms.admin_module.views module

class shuup.simple_cms.admin_module.views.PageForm(**kwargs)[source]

Bases: MultiLanguageModelForm

class Meta[source]

Bases: object

model

alias of Page

fields = ['title', 'url', 'content', 'available_from', 'available_to', 'identifier', 'visible_in_menu', 'parent', 'template_name', 'list_children_on_page', 'show_child_timestamps', 'render_title', 'available_permission_groups']
widgets = {'content': <shuup.admin.forms.widgets.TextEditorWidget object>}
__init__(**kwargs)[source]
clean()[source]

If title or content has been given on any language we must enforce that the other fields are also required in that language.

This is done the way it is because url is not required by default in model level.

clean_parent()[source]
save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

is_url_valid(language_code, field_name, url)[source]

Ensure URL given is unique.

Check through the pages translation model objects to make sure that the url given doesn’t already exist.

Possible failure cases: * for new page: 1. URL already exists

  • or existing page:

  1. URL (other than owned by existing page) exists

  2. URL exists in other languages of existing page

base_fields = {'available_from': <django.forms.fields.DateTimeField object>, 'available_permission_groups': <django.forms.models.ModelMultipleChoiceField object>, 'available_to': <django.forms.fields.DateTimeField object>, 'content': <django.forms.fields.CharField object>, 'identifier': <django.forms.fields.CharField object>, 'list_children_on_page': <django.forms.fields.BooleanField object>, 'parent': <mptt.forms.TreeNodeChoiceField object>, 'render_title': <django.forms.fields.BooleanField object>, 'show_child_timestamps': <django.forms.fields.BooleanField object>, 'template_name': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>, 'url': <django.forms.fields.CharField object>, 'visible_in_menu': <django.forms.fields.BooleanField object>}
declared_fields = {'available_from': <django.forms.fields.DateTimeField object>, 'available_to': <django.forms.fields.DateTimeField object>, 'content': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>, 'url': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class shuup.simple_cms.admin_module.views.PageBaseFormPart(request, object=None)[source]

Bases: FormPart

priority: int = 1
name = 'base'
get_form_defs()[source]
form_valid(form)[source]
class shuup.simple_cms.admin_module.views.PageEditView(**kwargs)[source]

Bases: SaveFormPartsMixin, FormPartsViewMixin, CreateOrUpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of Page

template_name = 'shuup/simple_cms/admin/edit.jinja'
base_form_part_classes: Any | Any = [<class 'shuup.simple_cms.admin_module.views.PageBaseFormPart'>]
context_object_name = 'page'
form_part_class_provide_key: str | None = 'admin_page_form_part'
add_form_errors_as_messages = True
get_toolbar()[source]
get_delete_url()[source]
get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

form_valid(form)[source]

If the form is valid, save the associated model.

class shuup.simple_cms.admin_module.views.PageListView[source]

Bases: PicotableListView

url_identifier = 'simple_cms.page'
model

alias of Page

default_columns = [<Column: Title> title, <Column: Available since> available_from, <Column: Available until> available_to, <Column: Created by> created_by, <Column: Date created> created_on]
get_object_abstract(instance, item)[source]

Get the object abstract lines (used for mobile layouts) for this object.

Supported keys in abstract line dicts are:

  • text (required)

  • title

  • class (CSS class name – header for instance)

  • raw (boolean; whether or not the text is raw HTML)

Parameters:
  • instance – The instance.

  • item – The item dict so far. Useful for reusing precalculated values.

Returns:

Iterable of dicts to pass through to the picotable javascript.

Return type:

Iterable[dict]

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

class shuup.simple_cms.admin_module.views.PageDeleteView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

queryset
get_success_url(*args, **kwargs)[source]
get_queryset(*args, **kwargs)[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

post(request, *args, **kwargs)[source]

Module contents

class shuup.simple_cms.admin_module.SimpleCMSAdminModule[source]

Bases: AdminModule

name = 'Content Pages'
breadcrumbs_menu_entry = <shuup.admin.base.MenuEntry object>
get_urls()[source]
Return type:

list[django.urls.RegexURLPattern]

get_menu_entries(request)[source]
Return type:

list[shuup.admin.base.MenuEntry]

get_help_blocks(request, kind)[source]
Parameters:
  • request (django.http.request.HttpRequest) – Request.

  • kind (str) – block kind. Currently “setup” or “quicklink”.

Return type:

list[shuup.admin.views.home.HelpBlock]

get_model_url(object, kind, shop=None)[source]

Retrieve an admin URL for the given object of the kind kind.

A falsy value must be returned if the module does not know how to reverse the given object.

Parameters:
Returns:

The reversed URL or none.

Return type:

str|None