Announcement¶
Qualified name: intranet.apps.announcements.models.Announcement
- class intranet.apps.announcements.models.Announcement(*args, **kwargs)[source]¶
Bases:
ModelRepresents 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.
- Parameters:
id (AutoField) – Primary key: ID
title (CharField) – Title
content (TextField) – Content
author (CharField) – Author
added (DateTimeField) – Added
updated (DateTimeField) – Updated
public (BooleanField) – Public. Restricted activities have announcements that are only visible to members of the activity. Enabling this will make the announcement visible to all users.
expiration_date (DateTimeField) – Expiration date
notify_post (BooleanField) – Notify post
notify_email_all (BooleanField) – Notify email all
pinned (BooleanField) – Pinned
Relationship fields:
- Parameters:
user (
ForeignKeytoUser) – User (related name:announcement)activity (
ForeignKeytoEighthActivity) – Activity (related name:announcement)groups (
ManyToManyFieldtoGroup) – Groups (related name:announcement)
Reverse relationships:
- Parameters:
_user_map (Reverse
OneToOneFieldfromAnnouncementUserMap) – The user map of this announcement (related name ofannouncement)announcementrequest (Reverse
ForeignKeyfromAnnouncementRequest) – All announcement requests of this announcement (related name ofposted)event (Reverse
ForeignKeyfromEvent) – All event of this announcement (related name ofannouncement)
Methods
can_modifyReturns 'author' if it is set.
get_next_by_addedFinds next instance based on
added.get_next_by_expiration_dateFinds next instance based on
expiration_date.get_next_by_updatedFinds next instance based on
updated.get_previous_by_addedFinds previous instance based on
added.get_previous_by_expiration_dateFinds previous instance based on
expiration_date.get_previous_by_updatedFinds previous instance based on
updated.is_visibleis_visible_requesteris_visible_submitterSave the model instance without creating a historical record.
Attributes
activityType:
ForeignKeytoEighthActivityactivity_idInternal field, use
activityinstead.Type:
DateTimeFieldannouncementrequestannouncementrequest_setType: Reverse
ForeignKeyfromAnnouncementRequestType:
CharFieldType:
TextFieldReturns the content of this announcement with all links nullified.
dashboard_typeeventType: Reverse
ForeignKeyfromEventexpiration_dateType:
DateTimeFieldgroupsType:
ManyToManyFieldtoGrouphistoryidType:
AutoFieldis_club_announcementReturn whether the announcement was created after July 1st of this school year.
notify_email_allType:
BooleanFieldnotify_postType:
BooleanFieldobjectspinnedType:
BooleanFieldpublicType:
BooleanFieldType:
CharFieldType:
DateTimeFielduserType:
ForeignKeytoUseruser_idInternal field, use
userinstead.- 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.
- 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.
- property is_this_year¶
Return whether the announcement was created after July 1st of this school year.
- save_without_historical_record(*args, **kwargs)¶
Save the model instance without creating a historical record.
Make sure you know what you’re doing before using this method.