pagetools.widgets package¶
Subpackages¶
Submodules¶
pagetools.widgets.admin module¶
- class pagetools.widgets.admin.BaseWidgetAdmin(model, admin_site)[source]¶
Bases:
ModelAdmin- property media¶
- response_add(request, obj, *args, **kwargs)[source]¶
Determine the HttpResponse for the add_view stage.
- response_change(request, obj, *args, **kwargs)[source]¶
Determine the HttpResponse for the change_view stage.
- save_as = True¶
- class pagetools.widgets.admin.ContentWidgetAdmin(model, admin_site)[source]¶
Bases:
BaseWidgetAdmin,TinyMCEMixin- property media¶
- class pagetools.widgets.admin.PageTypeAdmin(model, admin_site)[source]¶
Bases:
ModelAdmin- property media¶
- class pagetools.widgets.admin.TemplateTagWidgetAdmin(model, admin_site)[source]¶
Bases:
BaseWidgetAdmin- property media¶
pagetools.widgets.context_processors module¶
pagetools.widgets.models module¶
- class pagetools.widgets.models.BaseWidget(*args, **kwargs)[source]¶
Bases:
Model- adapter¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.commentsis a ReverseGenericManyToOneDescriptor instance.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- template_name = 'widgets/basewidget.html'¶
- 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.widgets.models.ContentWidget(*args, **kwargs)[source]¶
Bases:
BaseWidgetA wiget with a text area
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- adapter¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.commentsis a ReverseGenericManyToOneDescriptor instance.
- content¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
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>¶
- 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.widgets.models.PageType(*args, **kwargs)[source]¶
Bases:
ModelA key that defines which additional context should be added to the context.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
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>¶
- page_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- pagetype_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- 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.parentis aForwardManyToOneDescriptorinstance.
- parent_id¶
- typearea_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class pagetools.widgets.models.TemplateTagWidget(*args, **kwargs)[source]¶
Bases:
BaseWidgetRenders a TemplateTag
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- adapter¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.commentsis a ReverseGenericManyToOneDescriptor instance.
- get_renderclasskey_display(*, field=<django.db.models.fields.CharField: renderclasskey>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- key_choices = [('latest_question', 'latest_question'), ('subscribe', 'subscribe')]¶
- name¶
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>¶
- renderclasskey¶
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.widgets.models.TypeArea(*args, **kwargs)[source]¶
Bases:
LangModelAn area associated with a PageType
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- area¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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.
- get_area_display(*, field=<django.db.models.fields.CharField: area>)¶
- get_lang_display(*, field=<django.db.models.fields.CharField: lang>)¶
- id¶
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.
- objects = <pagetools.models.LangManager 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¶
- widgets¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class pagetools.widgets.models.WidgetInArea(*args, **kwargs)[source]¶
Bases:
ModelA widget associated with an area
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Provide a generic many-to-one relation through the
content_typeandobject_idfields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
- content_type¶
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.
- content_type_id¶
- enabled¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- object_id¶
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>¶
- position¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- typearea¶
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.
- typearea_id¶
pagetools.widgets.settings module¶
pagetools.widgets.utils module¶
- pagetools.widgets.utils.itersubclasses(cls)[source]¶
Generator over all subclasses of a given class, in depth first order.
>>> list(itersubclasses(int)) == [bool] True >>> class A(object): pass >>> class B(A): pass >>> class C(A): pass >>> class D(B,C): pass >>> class E(D): pass >>> >>> for cls in itersubclasses(A): ... print(cls.__name__) B D E C >>> # get ALL (new-style) classes currently defined >>> [cls.__name__ for cls in itersubclasses(object)] ['type', ...'tuple', ...]
pagetools.widgets.views module¶
- class pagetools.widgets.views.WidgetPagelikeMixin[source]¶
Bases:
WidgetViewMixinA WidgetViewMixin that tries to find the pagetype_name by kwargs or attribute