Managers#
- class lotus.managers.BasePublishedQuerySet(model=None, query=None, using=None, hints=None)[source]#
Base queryset for publication methods.
- get_published(target_date=None, language=None, private=None, prefix=None)[source]#
Return a queryset with published entries selected.
- Keyword Arguments:
target_date (datetime.datetime) – Datetime timezone aware for publication target, if empty default value will be the current datetime.
language (string) – Language code to filter on. If empty, language is not filtered.
private (boolean) – Either True or False to set lookup for ‘private’ field. If not given, private field will not be part of built lookups.
prefix (string) – Prefix to append on each lookup expression on publication dates fields (start/end). Commonly used to filter from a relation like
author__
. Default is empty.
- Returns:
Queryset to filter published entries.
- Return type:
queryset
- get_unpublished(target_date=None, language=None, prefix=None)[source]#
Return a queryset with unpublished entries selected.
- Keyword Arguments:
target_date (datetime.datetime) – Datetime timezone aware for publication target, if empty default value will be the current datetime.
language (string) – Language code to filter on. If empty, language is not filtered.
prefix (string) – Prefix to append on each lookup expression on publication dates fields (start/end). Commonly used to filter from a relation like
author__
. Default is empty.
- Returns:
Queryset to filter published entries.
- Return type:
queryset
- class lotus.managers.BaseTranslatedQuerySet(model=None, query=None, using=None, hints=None)[source]#
Base queryset for translation methods only.
- get_for_lang(language, prefix=None)[source]#
Return a queryset with unpublished entries selected.
- Parameters:
language (string) – Language code to filter on.
- Keyword Arguments:
prefix (string) – Prefix to append on each lookup expression. Commonly used to filterfrom a relation. Default is empty.
- Returns:
Queryset to filter published entries.
- Return type:
queryset
- get_siblings(source)[source]#
For given object, return the sibling objects which can be the original object and translation objects.
- Parameters:
source (object) – Object to use for its id and original_id used in queryset lookup.
- Returns:
Queryset with sibling articles. For an original article it will be all of its translations. For a translation article it will be its original article and all other original’s translation articles.
- Return type:
queryset
- class lotus.managers.ArticleQuerySet(model=None, query=None, using=None, hints=None)[source]#
Article queryset mix publication and translation QuerySet classes.