FeatureAnnouncementQuerySet¶
Qualified name: intranet.apps.features.models.FeatureAnnouncementQuerySet
- class intranet.apps.features.models.FeatureAnnouncementQuerySet(model=None, query=None, using=None, hints=None)[source]¶
Bases:
QuerySet
Methods
Filter to just the feature announcements that are currently 'active'.
Filter to just the feature announcements that should be shown for the given 'context'.
Filter to just the feature announcements that should be shown for the given request.
Filter to just the feature announcements that should be shown for the given user.
Attributes
- filter_active()[source]¶
Filter to just the feature announcements that are currently ‘active’.
- Returns:
The
QuerySet
of just ``FeatureAnnouncement``s that are currently ‘active’ (past their activation date, but not their expiration date).
- filter_for_context(context: str)[source]¶
Filter to just the feature announcements that should be shown for the given ‘context’.
- Parameters:
context – The name of the ‘context’ to filter feature announcements for, as returned by
helpers.get_feature_context()
.- Returns:
The
QuerySet
of ``FeatureAnnouncement``s filtered for the given ‘context’.
- filter_for_request(request)[source]¶
Filter to just the feature announcements that should be shown for the given request.
This calls
filter_active()
,filter_show_for_user()
, andfilter_for_context()
.- Parameters:
request – The request object to filter the feature announcements to show for.
- Returns:
The
QuerySet
of ``FeatureAnnouncement``s filtered for the given request.
- filter_show_for_user(user)[source]¶
Filter to just the feature announcements that should be shown for the given user.
For example, this excludes users who have “dismissed” the feature announcement.
- Parameters:
user – The user to filter the feature announcements to show for.
- Returns:
The
QuerySet
of just ``FeatureAnnouncement``s that should be shown for the given user.