EighthBlock

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

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

Bases: AbstractBaseEighthModel

Represents an eighth period block. .. attribute:: date

The date of the block.

signup_time

The recommended time at which all users should sign up. This does not prevent people from signing up at this time, however students will see the amount of time left to sign up. Defaults to 12:40.

block_letter

The block letter (e.g. A, B, A1, A2, SOL). Despite its name, it can now be more than just a letter.

locked

Whether signups are closed.

activities

List of EighthScheduledActivitys for the block.

override_blocks

List of EighthBlocks that the block overrides. This allows the half-blocks used during Techlab visits to be easily managed. If a student should only be allowed to sign up for either only block A or both blocks A1 and A2, then block A would override blocks A1 and A2, and blocks A1 and A2 would override block A.

comments

A short comments field displayed next to the block letter.

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

Methods

attendance_locked

Returns whether the block's attendance is locked.

date_in_past

Returns whether the block has already happened.

get_hidden_signups

Returns a QuerySet of EighthSignups whose users are not students but have signed up for an activity.

get_next_by_date

Finds next instance based on date.

get_previous_by_date

Finds previous instance based on date.

get_unsigned_students

Return a QuerySet of people who haven't signed up for an activity during this block.

in_clear_absence_period

Returns whether today's date is within the block's clear absence period.

is_today

Returns whether the block occurs today.

next_blocks

Gets future blocks this school year in order.

num_no_signups

Gets how many people have not signed up for an activity this block.

num_signups

Gets how many people have signed up for an activity this block.

previous_blocks

Gets the previous blocks this school year in order.

save

Capitalize the first letter of the block name.

save_without_historical_record

Save model without saving a historical record

signup_time_future

Returns whether the block closes in the future.

Attributes

activities

Type: ManyToManyField to EighthActivity

block_letter

Type: CharField

comments

Type: CharField

date

Type: DateField

eighthblock_set

Type: Reverse ManyToManyField from EighthBlock

eighthscheduledactivity_set

Type: Reverse ForeignKey from EighthScheduledActivity

eighthwaitlist_set

Type: Reverse ForeignKey from EighthWaitlist

formatted_date

Returns the block date, formatted according to settings.EIGHTH_BLOCK_DATE_FORMAT.

history

hybrid_text

Returns the user friendly name of a hybrid block. See Hybrid-README.rst.

id

Type: AutoField

is_this_year

Return whether the block occurs during this school year.

letter_width

Returns the width in pixels that should be allocated for the block_letter on the signup page.

locked

Type: BooleanField

objects

override_blocks

Type: ManyToManyField to EighthBlock

short_text

Returns the date and block letter for this block.

signup_time

Type: TimeField

attendance_locked() bool[source]

Returns whether the block’s attendance is locked. If the block’s attendance is locked, non-eighth admins cannot change attendance. :returns: Whether the block’s attendance is locked.

date_in_past() bool[source]

Returns whether the block has already happened. :returns: Whether the block’s date is in the past.

property formatted_date: str

Returns the block date, formatted according to settings.EIGHTH_BLOCK_DATE_FORMAT. :returns: The formatted block date.

get_hidden_signups() QuerySet | Collection[EighthSignup][source]

Returns a QuerySet of EighthSignups whose users are not students but have signed up for an activity. This is usually a list of signups for the z-Withdrawn from TJ activity. :returns: A QuerySet of users who are not current students but have signed up for an activity this block.

get_unsigned_students() QuerySet | Collection[User][source]

Return a QuerySet of people who haven’t signed up for an activity during this block. :returns: The users who have not signed up for an activity during this block.

property hybrid_text: str
Returns the user friendly name of a hybrid block. See Hybrid-README.rst.
    • P1 and * - P2 are returned as * (In-Person)

    • Virt is returned as * (Virtual)

Any other names are returned as themselves.

Returns:

The user friendly name of a hybrid block.

in_clear_absence_period() bool[source]

Returns whether today’s date is within the block’s clear absence period. This determines whether the option to clear an eighth period absence should be shown. If the block is not within the clear absence period, an absence cannot be cleared. :returns: Whether the current date is in the block’s clear absence period.

property is_this_year: bool

Return whether the block occurs during this school year. :returns: Whether the block occurs during this school year.

is_today() bool[source]

Returns whether the block occurs today. :returns: Whether the block occurs today.

property letter_width: int

Returns the width in pixels that should be allocated for the block_letter on the signup page. :returns: The width in pixels of the block letter.

next_blocks(quantity: int = -1) QuerySet | Collection[EighthBlock][source]

Gets future blocks this school year in order. :param quantity: The number of blocks to list after this block, or -1 for all following blocks.

Returns:

A QuerySet with the specified number of future blocks this school year. If quantity is passed, then the QuerySet will not be filter()-able.

num_no_signups() int[source]

Gets how many people have not signed up for an activity this block. :returns: The number of people who have not signed up for an activity during this block.

num_signups() int[source]

Gets how many people have signed up for an activity this block. :returns: The number of people who have signed up for an activity during this block.

previous_blocks(quantity: int = -1) QuerySet | Collection[EighthBlock][source]

Gets the previous blocks this school year in order. :param quantity: The number of blocks to list before this block, or -1 for all previous blocks.

Returns:

If quantity is not passed, returns a QuerySet with all the blocks this school year before this block. If quantity is passed, returns a list with the specified number of blocks this school year before this block.

save(*args, **kwargs)[source]

Capitalize the first letter of the block name.

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.

property short_text: str
Returns the date and block letter for this block.

It is returned in the format of MM/DD B, like “9/1 B”

Returns:

The date and block letter.

signup_time_future() bool[source]

Returns whether the block closes in the future. :returns: Whether the block’s signup time is in the future.