intranet.apps.announcements package¶
Submodules¶
intranet.apps.announcements.admin module¶
intranet.apps.announcements.api module¶
- class intranet.apps.announcements.api.ListCreateAnnouncement(**kwargs)[source]¶
Bases:
ListCreateAPIView
- permission_classes = (<class 'intranet.apps.announcements.api.IsAnnouncementAdminOrReadOnly'>,)¶
- serializer_class¶
alias of
AnnouncementSerializer
intranet.apps.announcements.forms module¶
- class intranet.apps.announcements.forms.AnnouncementAdminForm(*args, **kwargs)[source]¶
Bases:
Form
A form for allowing admin to edit notifications on requests.
- declared_fields = {'notify_email_all': <django.forms.fields.BooleanField object>, 'notify_post': <django.forms.fields.BooleanField object>}¶
- class intranet.apps.announcements.forms.AnnouncementEditForm(*args, **kwargs)[source]¶
Bases:
ModelForm
A form for generating an announcement.
- class Meta[source]¶
Bases:
object
- fields = ['title', 'author', 'content', 'groups', 'expiration_date', 'update_added_date', 'pinned']¶
- model¶
alias of
Announcement
- declared_fields = {'notify_email_all_resend': <django.forms.fields.BooleanField object>, 'notify_post_resend': <django.forms.fields.BooleanField object>, 'update_added_date': <django.forms.fields.BooleanField object>}¶
- expiration_date = <django.forms.widgets.DateTimeInput object>¶
- class intranet.apps.announcements.forms.AnnouncementForm(*args, **kwargs)[source]¶
Bases:
ModelForm
A form for generating an announcement.
- class Meta[source]¶
Bases:
object
- fields = ['title', 'author', 'content', 'groups', 'expiration_date', 'notify_post', 'notify_email_all', 'update_added_date', 'pinned']¶
- model¶
alias of
Announcement
- declared_fields = {'notify_email_all': <django.forms.fields.BooleanField object>, 'update_added_date': <django.forms.fields.BooleanField object>}¶
- expiration_date = <django.forms.widgets.DateTimeInput object>¶
- class intranet.apps.announcements.forms.AnnouncementRequestForm(*args, **kwargs)[source]¶
Bases:
ModelForm
A form for generating an announcement request.
- class Meta[source]¶
Bases:
object
- fields = ['title', 'author', 'content', 'expiration_date', 'teachers_requested', 'notes']¶
- model¶
alias of
AnnouncementRequest
- declared_fields = {}¶
intranet.apps.announcements.models module¶
- class intranet.apps.announcements.models.Announcement(*args, **kwargs)[source]¶
Bases:
Model
Represents an announcement.
- title¶
The title of the announcement
- content¶
The HTML content of the news post
- authors¶
The name of the author
- added¶
The date the announcement was added
- updated¶
The most recent date the announcement was updated
- user_map¶
An attribute corresponding with an AnnouncementUserMap object. A new object is automatically created if it does not exist.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- added¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property announcementrequest¶
- announcementrequest_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- author¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- content¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property content_no_links: str¶
Returns the content of this announcement with all links nullified.
- Returns:
The content of this announcement with all links nullified.
- property dashboard_type¶
- event¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- 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_author() str [source]¶
Returns ‘author’ if it is set. Otherwise, returns the name of the user who created the announcement.
- Returns:
The name of the author as it should be displayed with the announcement.
- get_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)¶
- get_next_by_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)¶
- get_previous_by_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)¶
- groups¶
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.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property is_this_year¶
Return whether the announcement was created after July 1st of this school year.
- notify_email_all¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- notify_post¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <intranet.apps.announcements.models.AnnouncementManager object>¶
- pinned¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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¶
- property user_map¶
- class intranet.apps.announcements.models.AnnouncementManager(*args, **kwargs)[source]¶
Bases:
Manager
Get a list of announcements marked as hidden for a given user (usually request.user).
These are all announcements visible to the user – they have just decided to hide them.
- visible_to_user(user)[source]¶
Get a list of visible announcements for a given user (usually request.user).
These visible announcements will be those that either have no groups assigned to them (and are therefore public) or those in which the user is a member.
Apparently this .filter() call occasionally returns duplicates, hence the .distinct()…
- class intranet.apps.announcements.models.AnnouncementRequest(*args, **kwargs)[source]¶
Bases:
Model
Represents a request for an announcement.
- title¶
The title of the announcement
- content¶
The HTML content of the news post
- notes¶
Notes for the person who approves the announcement
- added¶
The date the request was added
- updated¶
The most recent date the request was updated
- user¶
The user who submitted the request
- teachers_requested¶
The teachers requested to approve the request
- teachers_approved¶
The teachers who have approved the request
- posted¶
ForeignKey to Announcement if posted
- posted_by¶
The user (administrator) that approved the request
- rejected¶
Boolean describing whether the post was rejected by an administrator. This will hide it.
- admin_email_sent¶
Boolean describing whether an email was sent to an Intranet administrator to post the announcement.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- added¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- admin_email_sent¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- author¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- content¶
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_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)¶
- get_next_by_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)¶
- get_previous_by_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, 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.
- notes¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <intranet.apps.announcements.models.AnnouncementRequestManager object>¶
- posted¶
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.
- posted_by¶
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.
- posted_by_id¶
- posted_id¶
- rejected¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- rejected_by¶
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.
- rejected_by_id¶
- teachers_approved¶
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.
- teachers_requested¶
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.
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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.announcements.models.AnnouncementRequestManager(*args, **kwargs)[source]¶
Bases:
Manager
- class intranet.apps.announcements.models.AnnouncementRequestQuerySet(model=None, query=None, using=None, hints=None)[source]¶
Bases:
QuerySet
- class intranet.apps.announcements.models.AnnouncementRequest_teachers_approved(id, announcementrequest, user)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- announcementrequest¶
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.
- announcementrequest_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.announcements.models.AnnouncementRequest_teachers_requested(id, announcementrequest, user)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- announcementrequest¶
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.
- announcementrequest_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.announcements.models.AnnouncementUserMap(*args, **kwargs)[source]¶
Bases:
Model
Represents mapping fields between announcements and users.
These attributes would be a part of the Announcement model, but if they are, the last updated date is changed whenever a student sees or hides an announcement.
Access these through announcement.user_map
- If you are checking to see whether a user has hidden an announcement, use:
Announcement.objects.hidden_announcements(user)
- announcement¶
The one-to-one mapping between this object and the Announcement it is for
A many-to-many field of Users who have hidden this announcement
- users_seen¶
A many-to-many field of Users who have seen this announcement
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- announcement¶
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- announcement_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>¶
- users_hidden¶
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.
Bases:
Model
Bases:
ObjectDoesNotExist
Bases:
MultipleObjectsReturned
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
- class intranet.apps.announcements.models.AnnouncementUserMap_users_seen(id, announcementusermap, user)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- announcementusermap¶
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.
- announcementusermap_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.announcements.models.Announcement_groups(id, announcement, group)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- announcement¶
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.
- announcement_id¶
- group¶
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.
- group_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>¶
- class intranet.apps.announcements.models.WarningAnnouncement(*args, **kwargs)[source]¶
Bases:
Model
Warning in yellow to show on Ion
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- added¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- content¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)¶
- get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)¶
- get_type_display(*, field=<django.db.models.fields.CharField: type>)¶
- 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>¶
- property show_on_dashboard¶
- property show_on_login¶
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
intranet.apps.announcements.notifications module¶
- intranet.apps.announcements.notifications.admin_request_announcement_email(request, form, obj)[source]¶
Send an admin announcement request email.
form: The announcement request form obj: The announcement request object
- intranet.apps.announcements.notifications.announcement_approved_email(request, obj, req)[source]¶
Email the requested teachers and submitter whenever an administrator approves an announcement request.
obj: the Announcement object req: the AnnouncementRequest object
intranet.apps.announcements.serializers module¶
intranet.apps.announcements.tests module¶
- class intranet.apps.announcements.tests.AnnouncementTest(methodName='runTest')[source]¶
Bases:
IonTestCase
Tests for the announcements module.
intranet.apps.announcements.urls module¶
intranet.apps.announcements.views module¶
- intranet.apps.announcements.views.announcement_approved_hook(request, obj, req)[source]¶
Runs whenever an administrator approves an announcement request.
obj: the Announcement object req: the AnnouncementRequest object