Event¶
Qualified name: intranet.apps.events.models.Event
- class intranet.apps.events.models.Event(*args, **kwargs)[source]¶
Bases:
Model
An 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 (
ForeignKey
toUser
) – User (related name:event
)scheduled_activity (
ForeignKey
toEighthScheduledActivity
) – Scheduled activity (related name:event
)announcement (
ForeignKey
toAnnouncement
) – Announcement (related name:event
)approved_by (
ForeignKey
toUser
) – Approved by (related name:approved_event
)rejected_by (
ForeignKey
toUser
) – Rejected by (related name:rejected_event
)links (
ManyToManyField
toLink
) – Links (related name:event
)groups (
ManyToManyField
toGroup
) – Groups (related name:event
)attending (
ManyToManyField
toUser
) – Attending (related name:attending
)
Reverse relationships:
- Parameters:
_user_map (Reverse
OneToOneField
fromEventUserMap
) – The user map of this event (related name ofevent
)
Methods
Run when an event is created.
get_category_display
Shows the label of the
category
.get_next_by_added
Finds next instance based on
added
.get_next_by_updated
Finds next instance based on
updated
.get_open_to_display
Shows the label of the
open_to
.get_previous_by_added
Finds previous instance based on
added
.get_previous_by_updated
Finds previous instance based on
updated
.Checks whether the event is in the next or previous 2 weeks.
Attributes
Type:
DateTimeField
Type:
ForeignKey
toAnnouncement
announcement_id
Internal field, use
announcement
instead.Type:
BooleanField
Type:
ForeignKey
toUser
approved_by_id
Internal field, use
approved_by
instead.Type:
ManyToManyField
toUser
Type:
CharField
Return what type of object it is
Type:
TextField
Type:
ManyToManyField
toGroup
Return whether an event has happened.
id
Type:
AutoField
Return whether the event was created after the start of the school year.
Type:
ManyToManyField
toLink
Type:
CharField
objects
Type:
CharField
implement event pinning
Type:
BooleanField
Type:
BooleanField
Type:
ForeignKey
toUser
rejected_by_id
Internal field, use
rejected_by
instead.Type:
ForeignKey
toEighthScheduledActivity
scheduled_activity_id
Internal field, use
scheduled_activity
instead.Type:
BooleanField
Type:
BooleanField
Type:
DateTimeField
Type:
CharField
Type:
DateTimeField
Type:
ForeignKey
toUser
user_id
Internal field, use
user
instead.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