Event¶
Qualified name: intranet.apps.events.models.Event
- class intranet.apps.events.models.Event(*args, **kwargs)[source]¶
Bases:
ModelAn event available to the TJ community.
- links¶
Links to be attached to the event. Not currently used.
- Type:
LinksQuerySet
- added¶
Time created (automatically set).
- Type:
- updated¶
Time last modified (automatically set).
- Type:
- time¶
The date and time of the event.
- Type:
- scheduled_activity¶
An EighthScheduledActivity that should be linked with the event.
- Type:
- announcement¶
An Announcement that should be linked with the event.
- Type:
- groups¶
Groups that the event is visible to.
- Type:
GroupQuerySet
- attending¶
Users that are attending the event.
- Type:
UserQuerySet
- rejected¶
Whether the event was rejected and shouldn’t be shown in the list of events that need to be approved.
- Type:
- open_to¶
Whether this event is open to parents, students, or both, shown on the login page.
- Type:
- Parameters:
id (AutoField) – Primary key: ID
title (CharField) – Title
description (TextField) – Description
added (DateTimeField) – Added
updated (DateTimeField) – Updated
time (DateTimeField) – Time
location (CharField) – Location
show_attending (BooleanField) – Show attending
show_on_dashboard (BooleanField) – Show on dashboard
approved (BooleanField) – Approved
rejected (BooleanField) – Rejected
public (BooleanField) – Show on Login Page
category (CharField) – Category
open_to (CharField) – Open to
Relationship fields:
- Parameters:
user (
ForeignKeytoUser) – User (related name:event)scheduled_activity (
ForeignKeytoEighthScheduledActivity) – Scheduled activity (related name:event)announcement (
ForeignKeytoAnnouncement) – Announcement (related name:event)approved_by (
ForeignKeytoUser) – Approved by (related name:approved_event)rejected_by (
ForeignKeytoUser) – Rejected by (related name:rejected_event)links (
ManyToManyFieldtoLink) – Links (related name:event)groups (
ManyToManyFieldtoGroup) – Groups (related name:event)attending (
ManyToManyFieldtoUser) – Attending (related name:attending)
Reverse relationships:
- Parameters:
_user_map (Reverse
OneToOneFieldfromEventUserMap) – The user map of this event (related name ofevent)
Methods
Run when an event is created.
get_category_displayShows the label of the
category.get_next_by_addedFinds next instance based on
added.get_next_by_updatedFinds next instance based on
updated.get_open_to_displayShows the label of the
open_to.get_previous_by_addedFinds previous instance based on
added.get_previous_by_updatedFinds previous instance based on
updated.Checks whether the event is in the next or previous 2 weeks.
Attributes
Type:
DateTimeFieldType:
ForeignKeytoAnnouncementannouncement_idInternal field, use
announcementinstead.Type:
BooleanFieldType:
ForeignKeytoUserapproved_by_idInternal field, use
approved_byinstead.Type:
ManyToManyFieldtoUserType:
CharFieldReturn what type of object it is
Type:
TextFieldType:
ManyToManyFieldtoGroupReturn whether an event has happened.
idType:
AutoFieldReturn whether the event was created after the start of the school year.
Type:
ManyToManyFieldtoLinkType:
CharFieldobjectsType:
CharFieldimplement event pinning
Type:
BooleanFieldType:
BooleanFieldType:
ForeignKeytoUserrejected_by_idInternal field, use
rejected_byinstead.Type:
ForeignKeytoEighthScheduledActivityscheduled_activity_idInternal field, use
scheduled_activityinstead.Type:
BooleanFieldType:
BooleanFieldType:
DateTimeFieldType:
CharFieldType:
DateTimeFieldType:
ForeignKeytoUseruser_idInternal field, use
userinstead.Return or create an EventUserMap
- property dashboard_type¶
Return what type of object it is
- property happened¶
Return whether an event has happened.
- property is_this_year¶
Return whether the event was created after the start of the school year.
- property pinned¶
implement event pinning
- Type:
TODO
- show_fuzzy_date()[source]¶
Checks whether the event is in the next or previous 2 weeks.
- Returns:
Whether to display the fuzzy date.
- property user_map¶
Return or create an EventUserMap