User¶
Qualified name: intranet.apps.users.models.User
- class intranet.apps.users.models.User(*args, **kwargs)[source]¶
Bases:
AbstractBaseUser
,PermissionsMixin
Django User model subclass
- Parameters:
id (AutoField) – Primary key: ID
password (CharField) – Password
last_login (DateTimeField) – Last login
is_superuser (BooleanField) – Superuser status. Designates that this user has all permissions without explicitly assigning them.
username (CharField) – Username
user_locked (BooleanField) – User locked
oauth_and_api_access (BooleanField) – Oauth and api access. Whether the user can create OAuth applications and access the API.
first_login (DateTimeField) – First login
seen_welcome (BooleanField) – Seen welcome
last_global_logout_time (DateTimeField) – Last global logout time
receive_news_emails (BooleanField) – Receive news emails
receive_eighth_emails (BooleanField) – Receive eighth emails
receive_schedule_notifications (BooleanField) – Receive schedule notifications
student_id (CharField) – Student id
user_type (CharField) – User type
admin_comments (TextField) – Admin comments
graduation_year (IntegerField) – Graduation year
title (CharField) – Title
first_name (CharField) – First name
middle_name (CharField) – Middle name
last_name (CharField) – Last name
nickname (CharField) – Nickname
gender (CharField) – Gender
seen_april_fools (BooleanField) – Seen april fools
enable_april_fools (BooleanField) – Enable april fools
Relationship fields:
- Parameters:
counselor (
ForeignKey
toUser
) – Counselor (related name:students
)preferred_photo (
OneToOneField
toPhoto
) – Preferred photo (related name:+
)primary_email (
OneToOneField
toEmail
) – Primary email (related name:+
)bus_route (
ForeignKey
toRoute
) – Bus route (related name:user
)groups (
ManyToManyField
toGroup
) – Groups. The groups this user belongs to. A user will get all permissions granted to each of their groups. (related name:user_set
)user_permissions (
ManyToManyField
toPermission
) – User permissions. Specific permissions for this user. (related name:user_set
)
Reverse relationships:
- Parameters:
logentry (Reverse
ForeignKey
fromLogEntry
) – All log entries of this user (related name ofuser
)announcements_hidden (Reverse
ManyToManyField
fromAnnouncementUserMap
) – All announcements hidden of this user (related name ofusers_hidden
)announcements_seen (Reverse
ManyToManyField
fromAnnouncementUserMap
) – All announcements seen of this user (related name ofusers_seen
)announcement (Reverse
ForeignKey
fromAnnouncement
) – All announcements of this user (related name ofuser
)user (Reverse
ForeignKey
fromAnnouncementRequest
) – All user of this user (related name ofuser
)posted_by (Reverse
ForeignKey
fromAnnouncementRequest
) – All posted by of this user (related name ofposted_by
)rejected_by (Reverse
ForeignKey
fromAnnouncementRequest
) – All rejected by of this user (related name ofrejected_by
)teachers_requested (Reverse
ManyToManyField
fromAnnouncementRequest
) – All teachers requested of this user (related name ofteachers_requested
)teachers_approved (Reverse
ManyToManyField
fromAnnouncementRequest
) – All teachers approved of this user (related name ofteachers_approved
)sponsor_obj (Reverse
OneToOneField
fromEighthSponsor
) – The sponsor obj of this user (related name ofuser
)restricted_activity_set (Reverse
ManyToManyField
fromEighthActivity
) – All restricted activity set of this user (related name ofusers_allowed
)eighthactivity (Reverse
ManyToManyField
fromEighthActivity
) – All eighth activities of this user (related name ofusers_blacklisted
)subscribed_activity_set (Reverse
ManyToManyField
fromEighthActivity
) – All subscribed activity set of this user (related name ofsubscribers
)officer_for_set (Reverse
ManyToManyField
fromEighthActivity
) – All officer for set of this user (related name ofofficers
)club_sponsor_for_set (Reverse
ManyToManyField
fromEighthActivity
) – All club sponsor for set of this user (related name ofclub_sponsors
)favorited_activity_set (Reverse
ManyToManyField
fromEighthActivity
) – All favorited activity set of this user (related name offavorites
)eighthscheduledactivity_set (Reverse
ManyToManyField
fromEighthScheduledActivity
) – All eighthscheduledactivity set of this user (related name ofmembers
)eighthscheduledactivity_scheduledactivity_set (Reverse
ManyToManyField
fromEighthScheduledActivity
) – All eighthscheduledactivity scheduledactivity set of this user (related name ofwaitlist
)sticky_scheduledactivity_set (Reverse
ManyToManyField
fromEighthScheduledActivity
) – All sticky scheduledactivity set of this user (related name ofsticky_students
)eighthsignup (Reverse
ForeignKey
fromEighthSignup
) – All eighth signups of this user (related name ofuser
)eighthwaitlist (Reverse
ForeignKey
fromEighthWaitlist
) – All eighth waitlists of this user (related name ofuser
)enrichmentactivity (Reverse
ForeignKey
fromEnrichmentActivity
) – All enrichment activities of this user (related name ofuser
)enrichments_attending (Reverse
ManyToManyField
fromEnrichmentActivity
) – All enrichments attending of this user (related name ofattending
)enrichments_attended (Reverse
ManyToManyField
fromEnrichmentActivity
) – All enrichments attended of this user (related name ofattended
)events_hidden (Reverse
ManyToManyField
fromEventUserMap
) – All events hidden of this user (related name ofusers_hidden
)event (Reverse
ForeignKey
fromEvent
) – All events of this user (related name ofuser
)approved_event (Reverse
ForeignKey
fromEvent
) – All approved event of this user (related name ofapproved_by
)rejected_event (Reverse
ForeignKey
fromEvent
) – All rejected event of this user (related name ofrejected_by
)attending (Reverse
ManyToManyField
fromEvent
) – All attending of this user (related name ofattending
)tjstaruuidmap (Reverse
ForeignKey
fromTJStarUUIDMap
) – All tj star uuid maps of this user (related name ofuser
)notificationconfig (Reverse
OneToOneField
fromNotificationConfig
) – The notification config of this user (related name ofuser
)gcmnotification (Reverse
ForeignKey
fromGCMNotification
) – All gcm notifications of this user (related name ofuser
)feedback (Reverse
ForeignKey
fromFeedback
) – All feedbacks of this user (related name ofuser
)students (Reverse
ForeignKey
fromUser
) – All students of this user (related name ofcounselor
)properties (Reverse
OneToOneField
fromUserProperties
) – The properties of this user (related name ofuser
)dark_mode_properties (Reverse
OneToOneField
fromUserDarkModeProperties
) – The dark mode properties of this user (related name ofuser
)emails (Reverse
ForeignKey
fromEmail
) – All emails of this user (related name ofuser
)phones (Reverse
ForeignKey
fromPhone
) – All phones of this user (related name ofuser
)websites (Reverse
ForeignKey
fromWebsite
) – All websites of this user (related name ofuser
)photos (Reverse
ForeignKey
fromPhoto
) – All photos of this user (related name ofuser
)section (Reverse
ForeignKey
fromSection
) – All sections of this user (related name ofteacher
)printjob (Reverse
ForeignKey
fromPrintJob
) – All print jobs of this user (related name ofuser
)answer (Reverse
ForeignKey
fromAnswer
) – All answers of this user (related name ofuser
)answervote (Reverse
ManyToManyField
fromAnswerVote
) – All answer votes of this user (related name ofusers
)senior (Reverse
OneToOneField
fromSenior
) – The senior of this user (related name ofuser
)calculatorregistration (Reverse
ForeignKey
fromCalculatorRegistration
) – All calculator registrations of this user (related name ofuser
)computerregistration (Reverse
ForeignKey
fromComputerRegistration
) – All computer registrations of this user (related name ofuser
)phoneregistration (Reverse
ForeignKey
fromPhoneRegistration
) – All phone registrations of this user (related name ofuser
)lostitem (Reverse
ForeignKey
fromLostItem
) – All lost items of this user (related name ofuser
)founditem (Reverse
ForeignKey
fromFoundItem
) – All found items of this user (related name ofuser
)senioremailforward (Reverse
ForeignKey
fromSeniorEmailForward
) – All senior email forwards of this user (related name ofuser
)carapplication (Reverse
ForeignKey
fromCarApplication
) – All carapplication of this user (related name ofuser
)parkingapplication (Reverse
ForeignKey
fromParkingApplication
) – All parkingapplication of this user (related name ofuser
)parkingapplication_joint (Reverse
ForeignKey
fromParkingApplication
) – All parkingapplication joint of this user (related name ofjoint_user
)nomination_votes (Reverse
ForeignKey
fromNomination
) – All nomination votes of this user (related name ofnominator
)nomination_votes_received (Reverse
ForeignKey
fromNomination
) – All nomination votes received of this user (related name ofnominee
)trustedsession (Reverse
ForeignKey
fromTrustedSession
) – All trusted sessions of this user (related name ofuser
)feature_announcements_seen (Reverse
ManyToManyField
fromFeatureAnnouncement
) – All feature announcements seen of this user (related name ofusers_seen
)feature_announcements_dismissed (Reverse
ManyToManyField
fromFeatureAnnouncement
) – All feature announcements dismissed of this user (related name ofusers_dismissed
)oauth_cslapplication (Reverse
ForeignKey
fromCSLApplication
) – All oauth cslapplication of this user (related name ofuser
)request (Reverse
ForeignKey
fromRequest
) – All requests of this user (related name ofuser
)oauth2_provider_grant (Reverse
ForeignKey
fromGrant
) – All oauth2 provider grant of this user (related name ofuser
)oauth2_provider_accesstoken (Reverse
ForeignKey
fromAccessToken
) – All oauth2 provider accesstoken of this user (related name ofuser
)oauth2_provider_refreshtoken (Reverse
ForeignKey
fromRefreshToken
) – All oauth2 provider refreshtoken of this user (related name ofuser
)oauth2_provider_idtoken (Reverse
ForeignKey
fromIDToken
) – All oauth2 provider idtoken of this user (related name ofuser
)
Methods
Return the user's absence count.
Returns a
QuerySet
of the ``EighthSignup``s for which this user was absent.archive_admin_comments
Checks whether this user has permission to edit/manage the given group (either a Group or a group name).
Return the
EighthSponsor
that this user is associated with.Return full name, e.g.
get_gender_display
Shows the label of the
gender
.Get short (first) name of a user.
Returns the user used to authenticate signage displays
get_title_display
Shows the label of the
title
.get_user_type_display
Shows the label of the
user_type
.Handle a graduated user being deleted.
Returns whether a user has an admin permission (explicitly, or implied by being in the "admin_all" group)
Returns whether there are open polls thet this user has not yet voted in.
Returns whether a user is a member of a certain group.
Returns whether the user should have the Polls icon visible
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks in the next
num_days
days.If the user is a student, returns whether they are signed up for an activity during all eighth period blocks that are scheduled today.
Attributes
GENDER
TITLES
Override default Model Manager (objects) with
USER_TYPES
Returns the
Address
object representing this user's address, orNone
if it is not set or the current user does not have permission to access it.admin_comments
Type:
TextField
announcement_set
Type: Reverse
ForeignKey
fromAnnouncement
announcements_hidden
Type: Reverse
ManyToManyField
fromAnnouncementUserMap
announcements_seen
Type: Reverse
ManyToManyField
fromAnnouncementUserMap
answer_set
Type: Reverse
ForeignKey
fromAnswer
answervote_set
Type: Reverse
ManyToManyField
fromAnswerVote
approved_event
Type: Reverse
ForeignKey
fromEvent
attending
Type: Reverse
ManyToManyField
fromEvent
bus_route
Type:
ForeignKey
toRoute
bus_route_id
Internal field, use
bus_route
instead.calculatorregistration_set
Type: Reverse
ForeignKey
fromCalculatorRegistration
Checks if user can view the parking interface.
Checks if a user has the show_eighth permission.
Checks if a user has the show_telephone permission.
carapplication
Type: Reverse
ForeignKey
fromCarApplication
club_sponsor_for_set
Type: Reverse
ManyToManyField
fromEighthActivity
computerregistration_set
Type: Reverse
ForeignKey
fromComputerRegistration
counselor
Type:
ForeignKey
toUser
counselor_id
Internal field, use
counselor
instead.dark_mode_properties
Type: Reverse
OneToOneField
fromUserDarkModeProperties
Returns default photo (in binary) that should be used
Returns
self.full_name
.eighthactivity_set
Type: Reverse
ManyToManyField
fromEighthActivity
eighthscheduledactivity_scheduledactivity_set
Type: Reverse
ManyToManyField
fromEighthScheduledActivity
eighthscheduledactivity_set
Type: Reverse
ManyToManyField
fromEighthScheduledActivity
eighthsignup_set
Type: Reverse
ForeignKey
fromEighthSignup
eighthwaitlist_set
Type: Reverse
ForeignKey
fromEighthWaitlist
emails
Type: Reverse
ForeignKey
fromEmail
enable_april_fools
Type:
BooleanField
enrichmentactivity_set
Type: Reverse
ForeignKey
fromEnrichmentActivity
enrichments_attended
Type: Reverse
ManyToManyField
fromEnrichmentActivity
enrichments_attending
Type: Reverse
ManyToManyField
fromEnrichmentActivity
event_set
Type: Reverse
ForeignKey
fromEvent
events_hidden
Type: Reverse
ManyToManyField
fromEventUserMap
favorited_activity_set
Type: Reverse
ManyToManyField
fromEighthActivity
feature_announcements_dismissed
Type: Reverse
ManyToManyField
fromFeatureAnnouncement
feature_announcements_seen
Type: Reverse
ManyToManyField
fromFeatureAnnouncement
feedback_set
Type: Reverse
ForeignKey
fromFeedback
first_login
Type:
DateTimeField
first_name
Type:
CharField
founditem_set
Type: Reverse
ForeignKey
fromFoundItem
Return a QuerySet of activity id's and counts for the activities that a given user has signed up for more than settings.SIMILAR_THRESHOLD times
Return full name, e.g.
If the user has a nickname, returns their name in the format "Nickname Lastname." Otherwise, this is identical to full_name.
gcmnotification_set
Type: Reverse
ForeignKey
fromGCMNotification
gender
Type:
CharField
Returns the grade of a user.
Returns the number of the grade this user is currently in (9, 10, 11, or 12 for students).
graduation_year
Type:
IntegerField
groups
Type:
ManyToManyField
toGroup
Checks if a
Senior
model (seeintranet.apps.seniors.models.Senior
exists for the current user.id
Type:
AutoField
Returns this user's username.
Checks if the user is active.
Checks if user is an alumnus.
Checks if user is an announcements admin.
Checks if this user can take attendance for an eighth activity.
Checks if user is an attendance-only user.
Checks if user is a board admin.
Returns whether the user has the
bus
admin permission.Checks if this user is an officer of an eighth period activity.
Used only for club announcements permissions.
Checks if user is an eighth period admin.
Determine whether the given user is associated with an.
Checks if user is an Eighth Period office user.
Checks if user is an enrichment admin.
Checks if user is an events admin.
Returns whether the user is female.
Checks if user is a global admin.
Returns whether the user is male.
Returns whether the user is non-binary.
Checks if user has the admin permission 'parking'.
Checks if user has the admin permission 'printing'.
Checks if user needs the restricted view of Ion
Checks if user is a schedule admin.
Checks if user is a student in Grade 12.
Checks if user is a simple user (e.g.
Checks if a user should have access to the Django Admin interface.
Checks if user is a student.
Checks if user is a teacher.
Return a name in the format of: Lastname, Firstname [(Nickname)]
Return a name in the format of: Lastname, Firstname [(Nickname)] (Student ID/ID/Username)
Return a name in the format of: Lastname, F [(Nickname)]
last_global_logout_time
Type:
DateTimeField
last_name
Type:
CharField
logentry_set
Type: Reverse
ForeignKey
fromLogEntry
lostitem_set
Type: Reverse
ForeignKey
fromLostItem
middle_name
Type:
CharField
nickname
Type:
CharField
nomination_votes
Type: Reverse
ForeignKey
fromNomination
nomination_votes_received
Type: Reverse
ForeignKey
fromNomination
Returns the user's first non-TJ email found, or None if none is found.
Returns the notification email.
notificationconfig
Type: Reverse
OneToOneField
fromNotificationConfig
oauth2_provider_accesstoken
Type: Reverse
ForeignKey
fromAccessToken
oauth2_provider_grant
Type: Reverse
ForeignKey
fromGrant
oauth2_provider_idtoken
Type: Reverse
ForeignKey
fromIDToken
oauth2_provider_refreshtoken
Type: Reverse
ForeignKey
fromRefreshToken
oauth_and_api_access
Type:
BooleanField
oauth_cslapplication
Type: Reverse
ForeignKey
fromCSLApplication
objects
officer_for_set
Type: Reverse
ManyToManyField
fromEighthActivity
parkingapplication
Type: Reverse
ForeignKey
fromParkingApplication
parkingapplication_joint
Type: Reverse
ForeignKey
fromParkingApplication
Dynamically generate dictionary of privacy options.
phoneregistration_set
Type: Reverse
ForeignKey
fromPhoneRegistration
phones
Type: Reverse
ForeignKey
fromPhone
photos
Type: Reverse
ForeignKey
fromPhoto
posted_by
Type: Reverse
ForeignKey
fromAnnouncementRequest
preferred_photo
Type:
OneToOneField
toPhoto
preferred_photo_id
Internal field, use
preferred_photo
instead.primary_email
Type:
OneToOneField
toEmail
primary_email_address
primary_email_id
Internal field, use
primary_email
instead.printjob_set
Type: Reverse
ForeignKey
fromPrintJob
properties
Type: Reverse
OneToOneField
fromUserProperties
receive_eighth_emails
Type:
BooleanField
receive_news_emails
Type:
BooleanField
receive_schedule_notifications
Type:
BooleanField
recommended_activities
rejected_by
Type: Reverse
ForeignKey
fromAnnouncementRequest
rejected_event
Type: Reverse
ForeignKey
fromEvent
request_set
Type: Reverse
ForeignKey
fromRequest
restricted_activity_set
Type: Reverse
ManyToManyField
fromEighthActivity
Returns a QuerySet of the
Section
objects representing the classes this student is in, orNone
if the current user does not have permission to list this student's classes.section_set
Type: Reverse
ForeignKey
fromSection
seen_april_fools
Type:
BooleanField
seen_welcome
Type:
BooleanField
senior
Type: Reverse
OneToOneField
fromSenior
senioremailforward_set
Type: Reverse
ForeignKey
fromSeniorEmailForward
Returns the gender of this user (male, female, or non-binary).
Return short name (first name) of a user.
sponsor_obj
Type: Reverse
OneToOneField
fromEighthSponsor
sticky_scheduledactivity_set
Type: Reverse
ManyToManyField
fromEighthScheduledActivity
student_id
Type:
CharField
students
Type: Reverse
ForeignKey
fromUser
subscribed_activity_set
Type: Reverse
ManyToManyField
fromEighthActivity
teachers_approved
Type: Reverse
ManyToManyField
fromAnnouncementRequest
teachers_requested
Type: Reverse
ManyToManyField
fromAnnouncementRequest
title
Type:
CharField
Get (or guess) a user's TJ email.
tjstaruuidmap_set
Type: Reverse
ForeignKey
fromTJStarUUIDMap
trustedsession_set
Type: Reverse
ForeignKey
fromTrustedSession
user
Type: Reverse
ForeignKey
fromAnnouncementRequest
user_locked
Type:
BooleanField
user_permissions
Type:
ManyToManyField
toPermission
user_type
Type:
CharField
username
Type:
CharField
websites
Type: Reverse
ForeignKey
fromWebsite
- USERNAME_FIELD = 'username'¶
Override default Model Manager (objects) with
- _current_user_override() bool [source]¶
Return whether the currently logged in user is a teacher or eighth admin, and can view all of a student’s information regardless of their privacy settings.
- Returns:
Whether the user has permissions to view all of their information regardless of their privacy settings.
- absence_count() int [source]¶
Return the user’s absence count.
If the user has no absences or is not a signup user, returns 0.
- Returns:
The number of absences this user has.
- absence_info()[source]¶
Returns a
QuerySet
of the ``EighthSignup``s for which this user was absent.- Returns:
A
QuerySet
of the ``EighthSignup``s for which this user was absent.
- property address: Address | None¶
Returns the
Address
object representing this user’s address, orNone
if it is not set or the current user does not have permission to access it.- Returns:
The
Address
representing this user’s address, orNone
if that is unavailable to the current user.
- can_manage_group(group: Group | str) bool [source]¶
Checks whether this user has permission to edit/manage the given group (either a Group or a group name).
WARNING: Granting permission to edit/manage “admin_” groups gives that user control over nearly all data on Ion!
- Parameters:
group – The group to check permissions for.
- Returns:
Whether this user has permission to edit/manage the given group.
- property can_request_parking: bool¶
Checks if user can view the parking interface.
- Returns:
Whether this user can view the parking interface and request a parking spot.
- property can_view_eighth: bool¶
Checks if a user has the show_eighth permission.
- Returns:
Whether this user has made their eighth period signups public.
- property can_view_phone: bool¶
Checks if a user has the show_telephone permission.
- Returns:
Whether this user has made their phone number public.
- property default_photo: bytes | None¶
Returns default photo (in binary) that should be used
- Returns:
The binary representation of the user’s default photo.
- property frequent_signups¶
Return a QuerySet of activity id’s and counts for the activities that a given user has signed up for more than settings.SIMILAR_THRESHOLD times
- property full_name: str¶
Return full name, e.g. Angela William.
This is required for subclasses of User.
- Returns:
The user’s full name (first + “ “ + last).
- property full_name_nick: str¶
If the user has a nickname, returns their name in the format “Nickname Lastname.” Otherwise, this is identical to full_name.
- Returns:
The user’s full name, with their nickname substituted for their first name if it is set.
- get_eighth_sponsor()[source]¶
Return the
EighthSponsor
that this user is associated with.- Returns:
The
EighthSponsor
that this user is associated with.
- get_full_name() str [source]¶
Return full name, e.g. Angela William.
- Returns:
The user’s full name (see
full_name
).
- get_short_name() str [source]¶
Get short (first) name of a user.
- Returns:
The user’s first name (see
short_name
andfirst_name
).
- static get_signage_user() User [source]¶
Returns the user used to authenticate signage displays
- Returns:
The user used to authenticate signage displays
- property grade: Grade¶
Returns the grade of a user.
- Returns:
A Grade object representing the user’s current grade.
- property grade_number: int¶
Returns the number of the grade this user is currently in (9, 10, 11, or 12 for students).
- Returns:
The number of the grade this user is currently in.
- has_admin_permission(perm: str) bool [source]¶
Returns whether a user has an admin permission (explicitly, or implied by being in the “admin_all” group)
- Parameters:
perm – The admin permission to check for.
- Returns:
Whether the user has the given admin permission (either explicitly or implicitly)
- property has_senior: bool¶
Checks if a
Senior
model (seeintranet.apps.seniors.models.Senior
exists for the current user.- Returns:
Whether a
Senior
model (seeintranet.apps.seniors.models.Senior
exists for the current user.
- has_unvoted_polls() bool [source]¶
Returns whether there are open polls thet this user has not yet voted in.
- Returns:
Whether there are open polls thet this user has not yet voted in.
- property ion_username: str¶
Returns this user’s username.
- Returns:
This user’s username (see
username
).
- property is_active: bool¶
Checks if the user is active.
This is currently used to catch invalid logins.
- Returns:
Whether the user is “active” – i.e. their account is not locked.
- property is_announcements_admin: bool¶
Checks if user is an announcements admin.
- Returns:
Whether this user is an announcement admin.
- property is_attendance_taker: bool¶
Checks if this user can take attendance for an eighth activity.
- Returns:
Whether this user can take attendance for an eighth activity.
- property is_attendance_user: bool¶
Checks if user is an attendance-only user.
- Returns:
Whether this user is an attendance-only user.
- property is_board_admin: bool¶
Checks if user is a board admin.
- Returns:
Whether this user is a board admin.
- property is_bus_admin: bool¶
Returns whether the user has the
bus
admin permission.- Returns:
Whether the user has the
bus
admin permission.
- property is_club_officer: bool¶
Checks if this user is an officer of an eighth period activity.
- Returns:
Whether this user is an officer of an eighth period activity.
- property is_club_sponsor: bool¶
Used only for club announcements permissions. Not used for eighth period scheduling. Use User.is_eighth_sponsor for that instead.
- property is_eighth_admin: bool¶
Checks if user is an eighth period admin.
- Returns:
Whether this user is an eighth period admin.
- property is_eighth_sponsor: bool¶
Determine whether the given user is associated with an.
intranet.apps.eighth.models.EighthSponsor
and, therefore, should view activity sponsoring information.- Returns:
Whether this user is an eighth period sponsor.
- property is_eighthoffice: bool¶
Checks if user is an Eighth Period office user.
This is currently hardcoded, but is meant to be used instead of user.id == 9999 or user.username == “eighthoffice”.
- Returns:
Whether this user is an Eighth Period office user.
- property is_enrichment_admin: bool¶
Checks if user is an enrichment admin.
- Returns:
Whether this user is an enrichment admin.
- property is_events_admin: bool¶
Checks if user is an events admin.
- Returns:
Whether this user is an events admin.
- property is_global_admin: bool¶
Checks if user is a global admin.
- Returns:
Whether this user is a global admin, defined as having admin_all, Django staff, and Django superuser.
- property is_nonbinary: bool¶
Returns whether the user is non-binary.
- Returns:
Whether this user is non-binary.
- property is_parking_admin: bool¶
Checks if user has the admin permission ‘parking’.
- Returns:
Whether this user is a parking administrator.
- property is_printing_admin: bool¶
Checks if user has the admin permission ‘printing’.
- Returns:
Whether this user is a printing administrator.
- property is_restricted: bool¶
Checks if user needs the restricted view of Ion
This applies to users that are user_type ‘user’, user_type ‘alum’ or user_type ‘service’
- Returns:
Whether this user should see a restricted view of Ion.
- property is_schedule_admin: bool¶
Checks if user is a schedule admin.
- Returns:
Whether this user is a schedule admin.
- property is_senior: bool¶
Checks if user is a student in Grade 12.
- Returns:
Whether this user is a senior.
- property is_simple_user: bool¶
Checks if user is a simple user (e.g. eighth office user)
- Returns:
Whether this user is a simple user (e.g. eighth office user).
- property is_staff: bool¶
Checks if a user should have access to the Django Admin interface.
This has nothing to do with staff at TJ - is_staff has to be overridden to make this a valid user model.
- Returns:
Whether the user should have access to the Django Admin interface.
- property last_first_id: str¶
Return a name in the format of: Lastname, Firstname [(Nickname)] (Student ID/ID/Username)
- member_of(group: Group | str) bool [source]¶
Returns whether a user is a member of a certain group.
- Parameters:
group – Either the name of a group or a
Group
object.- Returns:
Whether the user is a member of the given group.
- property non_tj_email: str | None¶
Returns the user’s first non-TJ email found, or None if none is found.
If a user has a primary email set and it is not their TJ email, use that. Otherwise, use the first email found that is not their TJ email.
- Returns:
The first non-TJ email found for a user, or None if no such email is found.
- property notification_email: str¶
Returns the notification email.
If a primary email is set, use it. Otherwise, use the first email on file. If no email addresses exist, use the user’s TJ email.
- Returns:
A user’s notification email address.
- property permissions: Dict[str, bool]¶
Dynamically generate dictionary of privacy options.
- Returns:
A dictionary mapping the name of each privacy option to a boolean indicating whether it is enabled.
- property schedule: QuerySet | Collection[Section] | None¶
Returns a QuerySet of the
Section
objects representing the classes this student is in, orNone
if the current user does not have permission to list this student’s classes.- Returns:
Returns a QuerySet of the
Section
objects representing the classes this student is in, orNone
if the current user does not have permission to list this student’s classes.
- property sex: str¶
Returns the gender of this user (male, female, or non-binary).
- Returns:
The gender of this user (male, female, or non-binary).
- property short_name: str¶
Return short name (first name) of a user.
This is required for subclasses of User.
- Returns:
The user’s fist name.
- signed_up_next_few_days(*, num_days: int = 3) bool [source]¶
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks in the next
num_days
days. Otherwise, returnsTrue
.Today is counted as a day, so
signed_up_few_next_day(num_days=1)
is equivalent tosigned_up_today()
.- Parameters:
num_days – The number of days (including today) on which to search for blocks during which the user is signed up.
- Returns:
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks in the next
num_days
days. Otherwise, returnsTrue
.
- signed_up_today() bool [source]¶
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks that are scheduled today. Otherwise, returns
True
.- Returns:
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks that are scheduled today. Otherwise, returns
True
.
- property tj_email: str¶
Get (or guess) a user’s TJ email.
If a fcps.edu or tjhsst.edu email is specified in their email list, use that. Otherwise, append the user’s username to the proper email suffix, depending on whether they are a student or teacher.
- Returns:
The user’s found or guessed FCPS/TJ email address.