intranet.apps.announcements package

Submodules

intranet.apps.announcements.admin module

class intranet.apps.announcements.admin.AnnouncementAdmin(model, admin_site)[source]

Bases: SimpleHistoryAdmin

list_display = ('title', 'user', 'author', 'activity', 'added')
list_filter = ('added', 'updated', 'activity')
ordering = ('-added',)
raw_id_fields = ('user',)
search_fields = ('title', 'content', 'user__first_name', 'user__last_name', 'user__username')
class intranet.apps.announcements.admin.WarningAnnouncementAdmin(model, admin_site)[source]

Bases: SimpleHistoryAdmin

list_display = ('title', 'content', 'active')
list_filter = ('active',)
search_fields = ('title', 'content')

intranet.apps.announcements.api module

class intranet.apps.announcements.api.IsAnnouncementAdminOrReadOnly[source]

Bases: BasePermission

has_permission(request, view)[source]
class intranet.apps.announcements.api.ListCreateAnnouncement(**kwargs)[source]

Bases: ListCreateAPIView

get_queryset()[source]
permission_classes = (<class 'intranet.apps.announcements.api.IsAnnouncementAdminOrReadOnly'>,)
serializer_class

alias of AnnouncementSerializer

class intranet.apps.announcements.api.RetrieveUpdateDestroyAnnouncement(**kwargs)[source]

Bases: RetrieveUpdateDestroyAPIView

get_queryset()[source]
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(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[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']
help_texts = {'expiration_date': 'By default, announcements expire after two weeks. Choose the shortest time necessary.', 'notify_email_all': "This will send an email notification to all of the users who can see this post. This option does NOT take users' email notification preferences into account, so please use with care.", 'notify_post': 'If this box is checked, students who have signed up for notifications will receive an email.', 'update_added_date': 'If this announcement has already been added, update the added date to now so that the announcement is pushed to the top. If this option is not selected, the announcement will stay in its current position.'}
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 = {}
class intranet.apps.announcements.forms.ClubAnnouncementEditForm(*args, **kwargs)[source]

Bases: ModelForm

A form for editing a club announcement.

class Meta[source]

Bases: object

fields = ['title', 'content', 'expiration_date']
help_texts = {'expiration_date': 'By default, announcements expire after two weeks. Choose the shortest time necessary.'}
model

alias of Announcement

declared_fields = {}
expiration_date = <django.forms.widgets.DateTimeInput object>
class intranet.apps.announcements.forms.ClubAnnouncementForm(user, *args, **kwargs)[source]

Bases: ModelForm

A form for posting a club announcement.

class Meta[source]

Bases: object

fields = ['activity', 'title', 'content', 'expiration_date', 'notify_post']
help_texts = {'expiration_date': 'By default, announcements expire after two weeks. Choose the shortest time necessary.'}
model

alias of Announcement

declared_fields = {'notify_post': <django.forms.fields.BooleanField object>}
expiration_date = <django.forms.widgets.DateTimeInput object>

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

author

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

activity

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 a ForwardManyToOneDescriptor instance.

activity_id
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 a ReverseManyToOneDescriptor 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.

can_modify(user)[source]
content

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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 a ReverseManyToOneDescriptor 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 and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>
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_club_announcement
property is_this_year

Return whether the announcement was created after July 1st of this school year.

is_visible(user)[source]
is_visible_requester(user)[source]
is_visible_submitter(user)[source]
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.

save_without_historical_record(*args, **kwargs)

Save model without saving a historical record

Make sure you know what you’re doing before you use this method.

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 a ForwardManyToOneDescriptor instance.

user_id
property user_map
class intranet.apps.announcements.models.AnnouncementManager(*args, **kwargs)[source]

Bases: Manager

hidden_announcements(user)[source]

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.

this_year()[source]

Get AnnouncementRequests from this school year only.

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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 and Topping.pizzas are ManyToManyDescriptor 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 and Topping.pizzas are ManyToManyDescriptor 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 a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.announcements.models.AnnouncementRequestManager(*args, **kwargs)[source]

Bases: Manager

get_queryset()[source]
class intranet.apps.announcements.models.AnnouncementRequestQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: QuerySet

this_year()[source]

Get AnnouncementRequests from this school year only.

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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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

users_hidden

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 a ForwardOneToOneDescriptor 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 and Topping.pizzas are ManyToManyDescriptor 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 and Topping.pizzas are ManyToManyDescriptor 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.announcements.models.AnnouncementUserMap_users_hidden(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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor instance.

user_id
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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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>)
history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>
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>
save_without_historical_record(*args, **kwargs)

Save model without saving a historical record

Make sure you know what you’re doing before you use this method.

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.notifications.announcement_posted_email(request, obj, send_all=False)[source]

Send a notification posted email.

obj: The announcement object

intranet.apps.announcements.notifications.announcement_posted_twitter(request, obj)[source]
intranet.apps.announcements.notifications.notify_twitter(status)[source]
intranet.apps.announcements.notifications.request_announcement_email(request, form, obj)[source]

Send an announcement request email.

form: The announcement request form obj: The announcement request object

intranet.apps.announcements.serializers module

class intranet.apps.announcements.serializers.AnnouncementSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('url', 'id', 'title', 'content', 'author', 'user', 'added', 'updated', 'groups', 'pinned')
model

alias of Announcement

get_author(obj)[source]

intranet.apps.announcements.tests module

class intranet.apps.announcements.tests.AnnouncementTest(methodName='runTest')[source]

Bases: IonTestCase

Tests for the announcements module.

setUp()[source]
test_add_announcement_view()[source]
test_admin_approve_announcement_view()[source]
test_admin_request_status_view()[source]
test_announcement_approval_allowed_users()[source]

Tests to ensure that only allowed users can approve announcements.

test_announcement_request()[source]

Tests the announcement request view.

test_approve_announcement_view()[source]
test_change_announcements()[source]
test_delete_announcement_view()[source]
test_get_announcements()[source]
test_hide_announcement_view()[source]
test_modify_announcement_view()[source]
test_modify_club_announcement()[source]
test_request_announcement_success_self_view()[source]
test_request_announcement_success_view()[source]
test_show_announcement_view()[source]
test_view_announcement_view()[source]
class intranet.apps.announcements.tests.ApiTest(methodName='runTest')[source]

Bases: IonTestCase

test_api_announcements_detail()[source]
test_api_announcements_list()[source]

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

intranet.apps.announcements.views.announcement_posted_hook(request, obj)[source]

Runs whenever a new announcement is created, or a request is approved and posted.

obj: The Announcement object

Module contents

class intranet.apps.announcements.HistoricalAnnouncement(id, title, content, author, added, updated, expiration_date, notify_post, notify_email_all, pinned, user, activity, history_id, history_date, history_change_reason, history_type, history_user)

Bases: HistoricalChanges, Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activity

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 a ForwardManyToOneDescriptor instance.

activity_id
added

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.

static get_default_history_user(instance)

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)
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_history_date(*, field=<django.db.models.fields.DateTimeField: history_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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)
get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)
history_change_reason

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_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 a ForwardManyToOneDescriptor instance.

history_user_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property instance
instance_type

alias of Announcement

property next_record

Get the next history record for the instance. None if last.

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 = <django.db.models.manager.Manager object>
pinned

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property prev_record

Get the previous history record for the instance. None if first.

revert_url()

URL for this change in the default admin site.

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 a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.announcements.HistoricalWarningAnnouncement(id, title, content, type, active, added, history_id, history_date, history_change_reason, history_type, history_user)

Bases: HistoricalChanges, Model

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.

static get_default_history_user(instance)

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)
get_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=True, **kwargs)
get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)
get_previous_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)
get_type_display(*, field=<django.db.models.fields.CharField: type>)
history_change_reason

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history_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 a ForwardManyToOneDescriptor instance.

history_user_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property instance
instance_type

alias of WarningAnnouncement

property next_record

Get the next history record for the instance. None if last.

objects = <django.db.models.manager.Manager object>
property prev_record

Get the previous history record for the instance. None if first.

revert_url()

URL for this change in the default admin site.

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.