shoop.simple_cms package

Submodules

shoop.simple_cms.models module

class shoop.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 shoop.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

created_by
modified_by
parent
translations
objects = <django.db.models.manager.TreeManagerFromPageQuerySet object>
is_visible(dt=None)[source]
get_html()[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Page.MultipleObjectsReturned

Bases: django.core.exceptions.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 shoop.simple_cms.models.PageTranslation(id, language_code, title, url, content, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.simple_cms.models.DoesNotExist, shoop.simple_cms.models.DoesNotExist

exception PageTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PageTranslation.get_language_code_display(*moreargs, **morekwargs)
PageTranslation.master
PageTranslation.objects = <django.db.models.manager.Manager object>

shoop.simple_cms.plugins module

class shoop.simple_cms.plugins.PageLinksConfigForm(**kwargs)[source]

Bases: shoop.xtheme.plugins.forms.GenericPluginForm

A configuration for the PageLinksPlugin

populate()[source]

A custom populate method to display page choices

clean()[source]

A custom clean method to save page configuration information in a serializable form

base_fields = OrderedDict()
declared_fields = OrderedDict()
media
class shoop.simple_cms.plugins.PageLinksPlugin(config)[source]

Bases: shoop.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 = 'shoop/simple_cms/plugins/page_links.jinja'
editor_form_class

alias of PageLinksConfigForm

fields = [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7f5300eeac50>), ('show_all_pages', <django.forms.fields.BooleanField object at 0x7f5300d95978>), ('hide_expired', <django.forms.fields.BooleanField object at 0x7f5300d95320>), 'pages']
get_context_data(context)[source]

A custom get_context_data method to return pages, possibly filtering expired pages based on the plugin’s hide_expired setting

shoop.simple_cms.template_helpers module

class shoop.simple_cms.template_helpers.SimpleCMSTemplateHelpers[source]

Bases: object

name = 'simple_cms'
get_page_by_identifier(identifier)[source]
get_visible_pages()[source]

shoop.simple_cms.urls module

shoop.simple_cms.views module

class shoop.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 = 'shoop/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:
  1. Page is not found: raise Http404() like django would

  2. No translation in active language for the page: raise Http404()

  3. Translation was found for active language, but the url doesn’t match given url:

    return HttpResponseRedirect to the active languages url

  4. If none of the upper matches: render page normally

get_queryset()[source]

Module contents

class shoop.simple_cms.AppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

name = 'shoop.simple_cms'
verbose_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
label = 'shoop_simple_cms'
provides = {'xtheme_plugin': ['shoop.simple_cms.plugins:PageLinksPlugin'], 'front_template_helper_namespace': ['shoop.simple_cms.template_helpers:SimpleCMSTemplateHelpers'], 'front_urls_post': ['shoop.simple_cms.urls:urlpatterns'], 'admin_module': ['shoop.simple_cms.admin_module:SimpleCMSAdminModule']}