pagetools.pages package¶
Subpackages¶
- pagetools.pages.tests package
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- 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.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.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 = {}¶
- 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:
ModelPage with a login_required field.
The ::class::pagetools.pages.views.IncludedFormMixin will add email_receivers_list to the form kwargs.
- 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,PagelikeModelA 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_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>)¶
- 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.parentis aForwardManyToOneDescriptorinstance.
- 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:
IncludedFormIncluded Form with email recevivers field
The :class:pagetools.pages.views.IncludedFormMixin will add email_receivers_list to the form kwargs.
- 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.
- 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:
ModelMixin 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- 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.parentis aForwardManyToOneDescriptorinstance.
- 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:
ModelAbstract 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.BasePageView(**kwargs)[source]¶
Bases:
SelectedMenuentriesMixin,WidgetPagelikeMixin,DetailViewConstructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- class pagetools.pages.views.IncludedFormMixin[source]¶
Bases:
object- included_form = None¶
- success_url = '/'¶
- class pagetools.pages.views.IndexView(**kwargs)[source]¶
Bases:
PageViewConstructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- class pagetools.pages.views.PageView(**kwargs)[source]¶
Bases:
AuthPageMixin,IncludedFormMixin,BasePageViewConstructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
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.