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
EighthScheduledActivity
s for the block.
- override_blocks¶
List of
EighthBlock
s 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:
id (AutoField) – Primary key: ID
created_time (DateTimeField) – Created time
last_modified_time (DateTimeField) – Last modified time
date (DateField) – Date
signup_time (TimeField) – Signup time
block_letter (CharField) – Block letter
locked (BooleanField) – Locked
comments (CharField) – Comments
Relationship fields:
- Parameters:
activities (
ManyToManyField
toEighthActivity
) – Activities (related name:eighthblock
)override_blocks (
ManyToManyField
toEighthBlock
) – Override blocks (related name:eighthblock
)
Reverse relationships:
- Parameters:
eighthblock (Reverse
ManyToManyField
fromEighthBlock
) – All eighth blocks of this eighth block (related name ofoverride_blocks
)eighthscheduledactivity (Reverse
ForeignKey
fromEighthScheduledActivity
) – All eighth scheduled activities of this eighth block (related name ofblock
)eighthwaitlist (Reverse
ForeignKey
fromEighthWaitlist
) – All eighth waitlists of this eighth block (related name ofblock
)
Methods
Returns whether the block's attendance is locked.
Returns whether the block has already happened.
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
.Return a QuerySet of people who haven't signed up for an activity during this block.
Returns whether today's date is within the block's clear absence period.
Returns whether the block occurs today.
Gets future blocks this school year in order.
Gets how many people have not signed up for an activity this block.
Gets how many people have signed up for an activity this block.
Gets the previous blocks this school year in order.
Capitalize the first letter of the block name.
Save model without saving a historical record
Returns whether the block closes in the future.
Attributes
Type:
ManyToManyField
toEighthActivity
Type:
CharField
Type:
CharField
date
Type:
DateField
eighthblock_set
Type: Reverse
ManyToManyField
fromEighthBlock
eighthscheduledactivity_set
Type: Reverse
ForeignKey
fromEighthScheduledActivity
eighthwaitlist_set
Type: Reverse
ForeignKey
fromEighthWaitlist
Returns the block date, formatted according to
settings.EIGHTH_BLOCK_DATE_FORMAT
.history
Returns the user friendly name of a hybrid block. See Hybrid-README.rst.
id
Type:
AutoField
Return whether the block occurs during this school year.
Returns the width in pixels that should be allocated for the block_letter on the signup page.
Type:
BooleanField
objects
Type:
ManyToManyField
toEighthBlock
Returns the date and block letter for this block.
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.
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_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.