django_sorcery.views.base module¶
Base model view things with sqlalchemy.
-
class
django_sorcery.views.base.
BaseMultipleObjectMixin
[source]¶ Bases:
django_sorcery.views.base.SQLAlchemyMixin
Provides sqlalchemy support for list views.
-
allow_empty
= True¶
-
get_allow_empty
()[source]¶ Return
True
if the view should display empty lists andFalse
if a 404 should be raised instead.
-
get_paginate_by
(queryset)[source]¶ Get the number of items to paginate by, or
None
for no pagination.
-
get_paginate_orphans
()[source]¶ Return the maximum number of orphans extend the last page by when paginating.
-
get_paginator
(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]¶ Return an instance of the paginator for this view.
-
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.
-
ordering
= None¶
-
page_kwarg
= 'page'¶
-
paginate_by
= None¶
-
paginate_orphans
= 0¶
-
paginator_class
¶ alias of
django.core.paginator.Paginator
-
-
class
django_sorcery.views.base.
BaseSingleObjectMixin
[source]¶ Bases:
django_sorcery.views.base.SQLAlchemyMixin
Provides sqlalchemy support for detail views.
-
get_object
(queryset=None)[source]¶ Return the object the view is displaying.
Require self.queryset and the primary key attributes or the slug attributes in the URLconf. Subclasses can override this to return any object
-
object
= None¶
-
query_pkg_and_slug
= False¶
-
slug_field
= 'slug'¶
-
slug_url_kwarg
= 'slug'¶
-
-
class
django_sorcery.views.base.
SQLAlchemyMixin
[source]¶ Bases:
django.views.generic.base.ContextMixin
Provides sqlalchemy model view support like query, model, session, etc..
-
context_object_name
= None¶
-
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.
-
model
= None¶
-
query_options
= None¶
-
queryset
= None¶
-
session
= None¶
-