pagetools.pages package

Subpackages

Submodules

pagetools.pages.admin module

class pagetools.pages.admin.BasePageAdmin(model, admin_site)[source]

Bases: EntrieableAdmin, PagelikeAdmin

list_display = ('title', 'lang', 'slug', 'status')
list_filter = ('lang', 'status')
property media
readonly_fields = ('status_changed',)
save_as = True
search_fields = ('title', 'content')
class pagetools.pages.admin.PageAdmin(model, admin_site)[source]

Bases: BasePageAdmin

class Meta[source]

Bases: object

model

alias of Page

fieldsets = (('', {'fields': ['lang', 'status', 'title', 'slug', 'description', 'content']}), ('Included form', {'fields': ['included_form', 'email_receivers']}), ('Protection', {'fields': ['login_required']}), ('Show in menus', {'fields': ['menus']}), ('Pagetype', {'fields': ['pagetype']}))
property media
pagetools.pages.admin.pages_auto_entries()[source]

pagetools.pages.forms module

class pagetools.pages.forms.CaptchaContactForm(*args, **kwargs)[source]

Bases: ContactForm

base_fields = {'captcha': <captcha.fields.CaptchaField object>, 'message': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'sender': <django.forms.fields.EmailField object>, 'subject': <django.forms.fields.CharField object>}
declared_fields = {'captcha': <captcha.fields.CaptchaField object>, 'message': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'sender': <django.forms.fields.EmailField object>, 'subject': <django.forms.fields.CharField object>}
property media

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

class pagetools.pages.forms.ContactForm(*args, **kwargs)[source]

Bases: SendEmailForm

base_fields = {'message': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'sender': <django.forms.fields.EmailField object>, 'subject': <django.forms.fields.CharField object>}
declared_fields = {'message': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'sender': <django.forms.fields.EmailField object>, 'subject': <django.forms.fields.CharField object>}
property media

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

class pagetools.pages.forms.DynMultipleChoiceField(**kwargs)[source]

Bases: MultipleChoiceField

class pagetools.pages.forms.SendEmailForm(*args, **kwargs)[source]

Bases: Form

IGNORED_FIELDS_IN_MESSAGE = ('captcha',)
USE_MAILRECEIVERS = True
base_fields = {}
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

declared_fields = {}
get_error_msg()[source]
get_mailmessage()[source]
get_mailreceivers()[source]
get_mailsender()[source]
get_mailsubject()[source]
is_valid()[source]

Return True if the form has no errors, or False otherwise.

property media

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

pagetools.pages.models module

Models (mostly) for pages.

class pagetools.pages.models.AuthPage(*args, **kwargs)[source]

Bases: Model

Page with a login_required field.

The ::class::pagetools.pages.views.IncludedFormMixin will add email_receivers_list to the form kwargs.

class Meta[source]

Bases: object

abstract = False
login_required

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pagetools.pages.models.BasePage(*args, **kwargs)[source]

Bases: IncludedEmailForm, AuthPage, PagelikeModel

A basemodel for a page with one main content area

class Meta[source]

Bases: Meta

abstract = False
unique_together = ('slug', 'lang')
verbose_name = 'Page'
verbose_name_plural = 'Pages'
content

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created

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.

email_receivers

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()[source]

Dummy

get_included_form_display(*, field=<django.db.models.fields.CharField: included_form>)
get_lang_display(*, field=<django.db.models.fields.CharField: lang>)
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)
get_next_by_status_changed(*, field=<model_utils.fields.MonitorField: status_changed>, is_next=True, **kwargs)
get_pagetype(**kwargs)[source]
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)
get_previous_by_status_changed(*, field=<model_utils.fields.MonitorField: status_changed>, is_next=False, **kwargs)
get_status_display(*, field=<model_utils.fields.StatusField: status>)
included_form

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

lang

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

login_required

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects
pagetype

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 a ForwardManyToOneDescriptor instance.

pagetype_id
slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status_changed

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 pagetools.pages.models.IncludedEmailForm(*args, **kwargs)[source]

Bases: IncludedForm

Included Form with email recevivers field

The :class:pagetools.pages.views.IncludedFormMixin will add email_receivers_list to the form kwargs.

class Meta[source]

Bases: object

abstract = False
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.

email_receivers

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

email_receivers_list()[source]
get_included_form_display(*, field=<django.db.models.fields.CharField: included_form>)
included_form

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pagetools.pages.models.IncludedForm(*args, **kwargs)[source]

Bases: Model

Mixin that includes a form

expects in object:

includable_forms = {
    "name1": Form1,
    # [...]
}

or use the settings from the AppConfig for "pages"

This items will be available as choices for the included form field.

See pagetools.pages.views.IncludedFormMixin

class Meta[source]

Bases: object

abstract = False
get_included_form_display(*, field=<django.db.models.fields.CharField: included_form>)
includable_forms: Dict[str, Form] = {}
included_form

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pagetools.pages.models.Page(id, created, modified, status, status_changed, lang, title, slug, description, included_form, email_receivers, login_required, content, pagetype)[source]

Bases: BasePage

exception DoesNotExist

Bases: ObjectDoesNotExist

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.

created

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.

draft = <model_utils.managers.QueryManager object>
email_receivers

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_included_form_display(*, field=<django.db.models.fields.CharField: included_form>)
get_lang_display(*, field=<django.db.models.fields.CharField: lang>)
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)
get_next_by_status_changed(*, field=<model_utils.fields.MonitorField: status_changed>, is_next=True, **kwargs)
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)
get_previous_by_status_changed(*, field=<model_utils.fields.MonitorField: status_changed>, is_next=False, **kwargs)
get_status_display(*, field=<model_utils.fields.StatusField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

included_form

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

lang

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

login_required

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified

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.Manager object>
pagetype

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 a ForwardManyToOneDescriptor instance.

pagetype_id
published = <model_utils.managers.QueryManager object>
slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status_changed

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 pagetools.pages.models.PageBlockMixin(*args, **kwargs)[source]

Bases: Model

Abstract Content blocks for pages

class Meta[source]

Bases: object

abstract = False
ordering = ('position',)
verbose_name = 'Block'
content

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

position

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

visible

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

pagetools.pages.settings module

pagetools.pages.urls module

pagetools.pages.views module

class pagetools.pages.views.AuthPageMixin[source]

Bases: object

get_queryset(**kwargs)[source]
class pagetools.pages.views.BasePageView(**kwargs)[source]

Bases: SelectedMenuentriesMixin, WidgetPagelikeMixin, DetailView

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

class pagetools.pages.views.IncludedFormMixin[source]

Bases: object

form_invalid(form)[source]
form_valid(*_args, **_kwargs)[source]
get(request, *_args, **kwargs)[source]
get_form_class()[source]
get_form_kwargs()[source]
included_form = None
post(request, *_args, **kwargs)[source]
success_url = '/'
class pagetools.pages.views.IndexView(**kwargs)[source]

Bases: PageView

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

get_object(*_args, **_kwargs)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

class pagetools.pages.views.PageView(**kwargs)[source]

Bases: AuthPageMixin, IncludedFormMixin, BasePageView

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

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_pagetype(**kwargs)[source]
get_pagetype_name(**kwargs)[source]
model

alias of Page

Module contents

A pagetools.pages.models.Page (or abstract pagetools.pages.models.BasePage) inherits from Pagelike and adds

  • a “included_form” field, which consists of the Forms defined in the includable_forms attribute of the Model.

  • an “email_receivers” field which is only used if the selected an pagetools.pages.forms.SendEmailForm or a subclass.

  • a foreign key to pagetools.widgets.models.PageType (See Widgets)

  • a boolean field “login_required”

The pagetools.pages.views.PageView knows how to handle these attribues through its baseclasses/mixins.