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_active

Filter to just the feature announcements that are currently 'active'.

filter_for_context

Filter to just the feature announcements that should be shown for the given 'context'.

filter_for_request

Filter to just the feature announcements that should be shown for the given request.

filter_show_for_user

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(), and filter_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.