EighthActivity

Qualified name: intranet.apps.eighth.models.EighthActivity

class intranet.apps.eighth.models.EighthActivity(*args, **kwargs)[source]

Bases: AbstractBaseEighthModel

Represents an eighth period activity. .. attribute:: name

The name of the activity, max length 100 characters.

type:

str

description

The description of the activity, shown on the signup page below the other information. Information on an EighthScheduledActivity basis can be found in the “comments” field of that model. Max length 2000 characters.

Type:

str

sponsors

The default activity-level sponsors for the activity. On an EighthScheduledActivity basis, you should NOT query this field. Instead, use scheduled_activity.get_true_sponsors()

Type:

list of EighthSponsor

officers

The activity’s officers as chosen by a club sponsor.

Type:

list of User

rooms

The default activity-level rooms for the activity. On an EighthScheduledActivity basis, you should NOT query this field. Use scheduled_activity.get_true_rooms()

Type:

list of EighthRoom

default_capacity

The default capacity, which overrides the sum of the default rooms when scheduling the activity. By default, this has a null value and is ignored.

Type:

int

presign

If True, the activity can only be signed up for within 2 days of the day that the activity is scheduled.

Type:

bool

one_a_day

If True, a student can only sign up for one instance of this activity per day.

Type:

bool

both_blocks

If True, a signup for an EighthScheduledActivity during an A or B block will enforce and automatically trigger a signup on the other block. Does not enforce signups for blocks other than A and B.

Type:

bool

sticky

If True, then students who sign up or are placed in this activity cannot switch out of it. A sticky activity should also be restricted, unless you’re mean.

Type:

bool

special

If True, then the activity receives a special designation on the signup list, and is stuck to the top of the list.

Type:

bool

administrative

If True, then students cannot see the activity in their signup list. However, the activity still exists in the system and can be seen by administrators. Students can still sign up for the activity through the API – this does not prevent students from signing up for it, and just merely hides it from view. An administrative activity should be restricted.

Type:

bool

finance

The account name of the club with the Finance Office. If blank or null, there is no account.

Type:

str

restricted

Whether the signups for the activity are restricted to certain users/groups or if there are blacklisted users.

Type:

str

users_allowed

Individual users allowed to sign up for this activity. Extensive use of this is discouraged; make a group instead through the “Add and Assign Empty Group” button on the Edit Activity page. Only takes effect if the activity is restricted.

Type:

list of User

groups_allowed

Individual groups allowed to sign up for this activity. Only takes effect if the activity is restricted.

Type:

list of Group

users_blacklisted

Individual users who are not allowed to sign up for this activity. Only takes effect if the activity is not restricted.

Type:

list of User

freshman_allowed

Whether freshmen are allowed to sign up for this activity. Only takes effect if the activity is restricted.

Type:

bool

sophomores_allowed

Whether sophomores are allowed to sign up for this activity. Only takes effect if the activity is restricted.

Type:

bool

juniors_allowed

Whether juniors are allowed to sign up for this activity. Only takes effect if the activity is restricted.

Type:

bool

seniors_allowed

Whether seniors are allowed to sign up for this activity. Only takes effect if the activity is restricted.

Type:

bool

wed_a

Whether the activity generally meets on Wednesday A blocks. Does not affect schedule, is just information for the Eighth Office.

Type:

bool

wed_b

Whether the activity generally meets on Wednesday B blocks. Does not affect schedule, is just information for the Eighth Office.

Type:

bool

fri_a

Whether the activity generally meets on Friday A blocks. Does not affect schedule, is just information for the Eighth Office.

Type:

bool

fri_b

Whether the activity generally meets on Friday B blocks. Does not affect schedule, is just information for the Eighth Office.

Type:

bool

admin_comments

Notes for the Eighth Office.

Type:

str

favorites

A ManyToManyField of User objects who have favorited the activity.

Type:

list of User

similarities

A ManyToManyField of EighthActivitySimilarity objects which are similar to this activity.

Type:

list of EighthActivitySimilarity

subscribers

Individual users subscribed to this activity’s announcements.

Type:

list of User

deleted

Whether the activity still technically exists in the system, but was marked to be deleted.

Type:

bool

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

Methods

available_ids

Returns all available IDs not used by an EighthActivity.

capacity

Returns 'default_capacity' if it is set.

clean_subscribers

Removes any subscribers who are not allowed to subscribe to the activity.

get_active_schedulings

Returns all EighthScheduledActivitys scheduled this year for this activity.

is_subscribable_for_user

Returns whether a user can subscribe to the activity.

restricted_activities_available_to_user

Finds the restricted activities available to the given user.

save_without_historical_record

Save model without saving a historical record

Attributes

admin_comments

Type: CharField

administrative

Type: BooleanField

aid

The publicly visible activity ID.

announcement_set

Type: Reverse ForeignKey from Announcement

both_blocks

Type: BooleanField

club_sponsors

Type: ManyToManyField to User

default_capacity

Type: SmallIntegerField

deleted

Type: BooleanField

description

Type: CharField

eighthblock_set

Type: Reverse ManyToManyField from EighthBlock

eighthscheduledactivity_set

Type: Reverse ForeignKey from EighthScheduledActivity

favorites

Type: ManyToManyField to User

finance

Type: CharField

frequent_users

Return a QuerySet of user id's and counts that have signed up for this activity more than settings.SIMILAR_THRESHOLD times.

freshmen_allowed

Type: BooleanField

fri_a

Type: BooleanField

fri_b

Type: BooleanField

groups_allowed

Type: ManyToManyField to Group

history

id

Type: AutoField

is_active

Returns whether an activity is "active." An activity is considered to be active if it has been scheduled at all this year. Returns: Whether the activity is active.

is_popular

Returns whether this activity has more than settings.SIMILAR_THRESHOLD * 2 frequent_users.

juniors_allowed

Type: BooleanField

name

Type: CharField

name_with_flags

Return the activity name with special, both blocks, restricted, administrative, sticky, and deleted flags.

name_with_flags_no_restricted

Returns the activity's name with flags. These flags indicate whether the activity is special, both blocks, administrative, sticky, and/or cancelled. Returns: The activity name with all flags except the "restricted" flag.

objects

officers

Type: ManyToManyField to User

one_a_day

Type: BooleanField

presign

Type: BooleanField

restricted

Type: BooleanField

rooms

Type: ManyToManyField to EighthRoom

seniors_allowed

Type: BooleanField

similarities

Type: ManyToManyField to EighthActivitySimilarity

sophomores_allowed

Type: BooleanField

special

Type: BooleanField

sponsors

Type: ManyToManyField to EighthSponsor

sticky

Type: BooleanField

subscribers

Type: ManyToManyField to User

subscriptions_enabled

Type: BooleanField

undeleted_objects

users_allowed

Type: ManyToManyField to User

users_blacklisted

Type: ManyToManyField to User

wed_a

Type: BooleanField

wed_b

Type: BooleanField

_name_with_flags(include_restricted: bool, title: str | None = None) str[source]

Generates the activity’s name with flags. :param include_restricted: Whether to include the “restricted” flag. :param title: An optional title to add after the activity name (but before the flags)

Returns:

The activity name with all the appropriate flags.

property aid: int

The publicly visible activity ID. :returns: The public activity ID.

classmethod available_ids() List[int][source]

Returns all available IDs not used by an EighthActivity. :returns: A list of the available activity IDs.

capacity() int[source]

Returns ‘default_capacity’ if it is set. Otherwise, returns the total capacity of all the activity’s rooms. :returns: The activity’s capacity.

clean_subscribers()[source]

Removes any subscribers who are not allowed to subscribe to the activity.

property frequent_users: QuerySet | Collection[User]

Return a QuerySet of user id’s and counts that have signed up for this activity more than settings.SIMILAR_THRESHOLD times. This is used for suggesting activities to users. :returns: A QuerySet of users who attend this activity frequently.

get_active_schedulings() QuerySet | Collection[EighthScheduledActivity][source]

Returns all EighthScheduledActivitys scheduled this year for this activity. :returns: EighthScheduledActivitys of this activity occurring this year.

property is_active: bool

Returns whether an activity is “active.” An activity is considered to be active if it has been scheduled at all this year.

Returns:

Whether the activity is active.

Returns whether this activity has more than settings.SIMILAR_THRESHOLD * 2 frequent_users. :returns: Whether this activity has more than settings.SIMILAR_THRESHOLD * 2 frequent_users.

is_subscribable_for_user(user) bool[source]

Returns whether a user can subscribe to the activity.

Parameters:

user – The user to check.

Returns:

Whether the user can subscribe to the activity.

property name_with_flags: str

Return the activity name with special, both blocks, restricted, administrative, sticky, and deleted flags. :returns: The activity name with all flags.

property name_with_flags_no_restricted: str

Returns the activity’s name with flags. These flags indicate whether the activity is special, both blocks, administrative, sticky, and/or cancelled.

Returns:

The activity name with all flags except the “restricted” flag.

classmethod restricted_activities_available_to_user(user: User) List[int][source]

Finds the restricted activities available to the given user. :param user: The User to find the restricted activities for.

Returns:

The restricted activities available to the user.

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.