calingen.models.queryset

App-specific implementation of django.db.models.QuerySet.

Module Contents

Classes

CalingenQuerySet

Base class for all app-specific QuerySet implementations.

class calingen.models.queryset.CalingenQuerySet(model=None, query=None, using=None, hints=None)

Bases: django.db.models.QuerySet

Base class for all app-specific QuerySet implementations.

Notes

This QuerySet implementation provides app-specific augmentations, most notable the ability to filter the resulting set by the class’s owner attribute, which is a reference to AUTH_USER_MODEL.

The app’s QuerySet implementations are applied by the model’s specific implementation of django.db.models.Manager, which is available as attribute calingen_manager on every model of the calingen app.

default()

Return a queryset with annotations.

Returns:

The annotated queryset.

Return type:

django.db.models.QuerySet

Warning

Currently, this method does nothing on its own, but is kept to keep the app’s specific QuerySets consistent.

abstract filter_by_user(user)

Return a queryset filtered by the owner attribute.

Parameters:

user – An instance of the project’s user model, as specified by AUTH_USER_MODEL.

Returns:

The filtered queryset.

Return type:

django.db.models.QuerySet

Notes

Effectively, this method is used to ensure, that any user may only access objects, which are owned by him. This is the app’s way of ensuring row-level permissions, because only owners are allowed to view (and modify) their events.