calingen.models.queryset¶
App-specific implementation of django.db.models.QuerySet.
Module Contents¶
Classes¶
Base class for all app-specific |
- class calingen.models.queryset.CalingenQuerySet(model=None, query=None, using=None, hints=None)¶
Bases:
django.db.models.QuerySetBase class for all app-specific
QuerySetimplementations.Notes
This
QuerySetimplementation provides app-specific augmentations, most notable the ability to filter the resulting set by the class’sownerattribute, which is a reference toAUTH_USER_MODEL.The app’s
QuerySetimplementations are applied by the model’s specific implementation ofdjango.db.models.Manager, which is available as attributecalingen_manageron 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
ownerattribute.- 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.