intranet.apps.features package¶
Submodules¶
intranet.apps.features.admin module¶
intranet.apps.features.context_processors module¶
intranet.apps.features.helpers module¶
- intranet.apps.features.helpers.get_feature_context(request) Optional[str] [source]¶
Given a Django request, returns the ‘context’ that should be used to select feature announcements to display (one of
dashboard
,login
,eighth_signup
, orNone
).- Parameters:
request – The current request object.
- Returns:
The “context” that should be used to select feature announcements for the page requested by
request
.
intranet.apps.features.models module¶
- class intranet.apps.features.models.FeatureAnnouncement(*args, **kwargs)[source]¶
Bases:
Model
Represents an announcement about a new feature on Ion that should be shown to the school.
- activation_date¶
The date on which this feature announcement should first appear.
- Type:
- expiration_date¶
The date on which this feature announcement should last appear.
- Type:
- context¶
The “context” (essentially the page) in which this feature announcement should be shown. Currently supported: dashboard, login, eighth_signup
- Type:
- announcement_html¶
The HTML of the actual announcement. WARNING: This is rendered as ‘safe’ to allow things like links. Do NOT allow untrusted content here.
- Type:
- users_dismissed¶
The users who have dismissed this feature announcement (clicked the close button). Used to hide feature announcements the user has dismissed.
- Type:
list
ofUser
- CONTEXTS = (('dashboard', 'dashboard'), ('login', 'login'), ('eighth_signup', 'eighth_signup'))¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- activation_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- announcement_html¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- context¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- expiration_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_context_display(*, field=<django.db.models.fields.CharField: context>)¶
- get_next_by_activation_date(*, field=<django.db.models.fields.DateField: activation_date>, is_next=True, **kwargs)¶
- get_next_by_expiration_date(*, field=<django.db.models.fields.DateField: expiration_date>, is_next=True, **kwargs)¶
- get_previous_by_activation_date(*, field=<django.db.models.fields.DateField: activation_date>, is_next=False, **kwargs)¶
- get_previous_by_expiration_date(*, field=<django.db.models.fields.DateField: expiration_date>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.ManagerFromFeatureAnnouncementQuerySet object>¶
- users_dismissed¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- users_seen¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class intranet.apps.features.models.FeatureAnnouncementQuerySet(model=None, query=None, using=None, hints=None)[source]¶
Bases:
QuerySet
- 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.
- class intranet.apps.features.models.FeatureAnnouncement_users_dismissed(id, featureannouncement, user)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- featureannouncement¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- featureannouncement_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- class intranet.apps.features.models.FeatureAnnouncement_users_seen(id, featureannouncement, user)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- featureannouncement¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- featureannouncement_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
intranet.apps.features.tests module¶
- class intranet.apps.features.tests.FeaturesTest(methodName='runTest')[source]¶
Bases:
IonTestCase