Announcement¶
Qualified name: intranet.apps.announcements.models.Announcement
- 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.
- 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 (
ForeignKey
toUser
) – User (related name:announcement
)activity (
ForeignKey
toEighthActivity
) – Activity (related name:announcement
)groups (
ManyToManyField
toGroup
) – Groups (related name:announcement
)
Reverse relationships:
- Parameters:
_user_map (Reverse
OneToOneField
fromAnnouncementUserMap
) – The user map of this announcement (related name ofannouncement
)announcementrequest (Reverse
ForeignKey
fromAnnouncementRequest
) – All announcement requests of this announcement (related name ofposted
)event (Reverse
ForeignKey
fromEvent
) – All event of this announcement (related name ofannouncement
)
Methods
can_modify
Returns 'author' if it is set.
get_next_by_added
Finds next instance based on
added
.get_next_by_expiration_date
Finds next instance based on
expiration_date
.get_next_by_updated
Finds next instance based on
updated
.get_previous_by_added
Finds previous instance based on
added
.get_previous_by_expiration_date
Finds previous instance based on
expiration_date
.get_previous_by_updated
Finds previous instance based on
updated
.is_visible
is_visible_requester
is_visible_submitter
Save model without saving a historical record
Attributes
activity
Type:
ForeignKey
toEighthActivity
activity_id
Internal field, use
activity
instead.Type:
DateTimeField
announcementrequest
announcementrequest_set
Type: Reverse
ForeignKey
fromAnnouncementRequest
Type:
CharField
Type:
TextField
Returns the content of this announcement with all links nullified.
dashboard_type
event
Type: Reverse
ForeignKey
fromEvent
expiration_date
Type:
DateTimeField
groups
Type:
ManyToManyField
toGroup
history
id
Type:
AutoField
is_club_announcement
Return whether the announcement was created after July 1st of this school year.
notify_email_all
Type:
BooleanField
notify_post
Type:
BooleanField
objects
pinned
Type:
BooleanField
public
Type:
BooleanField
Type:
CharField
Type:
DateTimeField
user
Type:
ForeignKey
toUser
user_id
Internal field, use
user
instead.- 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 model without saving a historical record
Make sure you know what you’re doing before you use this method.