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.

title

The title for the event.

Type:

str

description

A description about the event.

Type:

str

Links to be attached to the event. Not currently used.

Type:

LinksQuerySet

added

Time created (automatically set).

Type:

datetime.datetime

updated

Time last modified (automatically set).

Type:

datetime.datetime

time

The date and time of the event.

Type:

datetime.datetime

location

Where the event is located.

Type:

str

user

The user who created the event.

Type:

User

scheduled_activity

An EighthScheduledActivity that should be linked with the event.

Type:

EighthScheduledActivity

announcement

An Announcement that should be linked with the event.

Type:

Announcement

groups

Groups that the event is visible to.

Type:

GroupQuerySet

attending

Users that are attending the event.

Type:

UserQuerySet

show_attending

Whether users can mark if they are attending or not attending.

Type:

bool

show_on_dashboard

Whether the event will be shown on the dashboard.

Type:

bool

approved

Whether the event has been approved and will be displayed.

Type:

bool

approved_by

The user who approved the event.

Type:

User

rejected

Whether the event was rejected and shouldn’t be shown in the list of events that need to be approved.

Type:

bool

rejected_by

The user who rejected the event.

Type:

User

public

Whether the event is public and can be shown on the login page.

Type:

bool

category

The category of the event, used for ordering on the login page.

Type:

str

open_to

Whether this event is open to parents, students, or both, shown on the login page.

Type:

bool

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

_user_map (Reverse OneToOneField from EventUserMap) – The user map of this event (related name of event)

Methods

created_hook

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.

show_fuzzy_date

Checks whether the event is in the next or previous 2 weeks.

Attributes

added

Type: DateTimeField

announcement

Type: ForeignKey to Announcement

announcement_id

Internal field, use announcement instead.

approved

Type: BooleanField

approved_by

Type: ForeignKey to User

approved_by_id

Internal field, use approved_by instead.

attending

Type: ManyToManyField to User

category

Type: CharField

dashboard_type

Return what type of object it is

description

Type: TextField

groups

Type: ManyToManyField to Group

happened

Return whether an event has happened.

id

Type: AutoField

is_this_year

Return whether the event was created after the start of the school year.

links

Type: ManyToManyField to Link

location

Type: CharField

objects

open_to

Type: CharField

pinned

implement event pinning

public

Type: BooleanField

rejected

Type: BooleanField

rejected_by

Type: ForeignKey to User

rejected_by_id

Internal field, use rejected_by instead.

scheduled_activity

Type: ForeignKey to EighthScheduledActivity

scheduled_activity_id

Internal field, use scheduled_activity instead.

show_attending

Type: BooleanField

show_on_dashboard

Type: BooleanField

time

Type: DateTimeField

title

Type: CharField

updated

Type: DateTimeField

user

Type: ForeignKey to User

user_id

Internal field, use user instead.

user_map

Return or create an EventUserMap

created_hook(request)[source]

Run when an event is created.

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