User¶
Qualified name: intranet.apps.users.models.User
- class intranet.apps.users.models.User(*args, **kwargs)[source]¶
Bases:
AbstractBaseUser,PermissionsMixinDjango 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 (
ForeignKeytoUser) – Counselor (related name:students)preferred_photo (
OneToOneFieldtoPhoto) – Preferred photo (related name:+)primary_email (
OneToOneFieldtoEmail) – Primary email (related name:+)bus_route (
ForeignKeytoRoute) – Bus route (related name:user)groups (
ManyToManyFieldtoGroup) – 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 (
ManyToManyFieldtoPermission) – User permissions. Specific permissions for this user. (related name:user_set)
Reverse relationships:
- Parameters:
logentry (Reverse
ForeignKeyfromLogEntry) – All log entries of this user (related name ofuser)announcements_hidden (Reverse
ManyToManyFieldfromAnnouncementUserMap) – All announcements hidden of this user (related name ofusers_hidden)announcements_seen (Reverse
ManyToManyFieldfromAnnouncementUserMap) – All announcements seen of this user (related name ofusers_seen)announcement (Reverse
ForeignKeyfromAnnouncement) – All announcements of this user (related name ofuser)user (Reverse
ForeignKeyfromAnnouncementRequest) – All user of this user (related name ofuser)posted_by (Reverse
ForeignKeyfromAnnouncementRequest) – All posted by of this user (related name ofposted_by)rejected_by (Reverse
ForeignKeyfromAnnouncementRequest) – All rejected by of this user (related name ofrejected_by)teachers_requested (Reverse
ManyToManyFieldfromAnnouncementRequest) – All teachers requested of this user (related name ofteachers_requested)teachers_approved (Reverse
ManyToManyFieldfromAnnouncementRequest) – All teachers approved of this user (related name ofteachers_approved)sponsor_obj (Reverse
OneToOneFieldfromEighthSponsor) – The sponsor obj of this user (related name ofuser)restricted_activity_set (Reverse
ManyToManyFieldfromEighthActivity) – All restricted activity set of this user (related name ofusers_allowed)eighthactivity (Reverse
ManyToManyFieldfromEighthActivity) – All eighth activities of this user (related name ofusers_blacklisted)subscribed_activity_set (Reverse
ManyToManyFieldfromEighthActivity) – All subscribed activity set of this user (related name ofsubscribers)officer_for_set (Reverse
ManyToManyFieldfromEighthActivity) – All officer for set of this user (related name ofofficers)club_sponsor_for_set (Reverse
ManyToManyFieldfromEighthActivity) – All club sponsor for set of this user (related name ofclub_sponsors)favorited_activity_set (Reverse
ManyToManyFieldfromEighthActivity) – All favorited activity set of this user (related name offavorites)eighthscheduledactivity_set (Reverse
ManyToManyFieldfromEighthScheduledActivity) – All eighthscheduledactivity set of this user (related name ofmembers)eighthscheduledactivity_scheduledactivity_set (Reverse
ManyToManyFieldfromEighthScheduledActivity) – All eighthscheduledactivity scheduledactivity set of this user (related name ofwaitlist)sticky_scheduledactivity_set (Reverse
ManyToManyFieldfromEighthScheduledActivity) – All sticky scheduledactivity set of this user (related name ofsticky_students)eighthsignup (Reverse
ForeignKeyfromEighthSignup) – All eighth signups of this user (related name ofuser)eighthwaitlist (Reverse
ForeignKeyfromEighthWaitlist) – All eighth waitlists of this user (related name ofuser)enrichmentactivity (Reverse
ForeignKeyfromEnrichmentActivity) – All enrichment activities of this user (related name ofuser)enrichments_attending (Reverse
ManyToManyFieldfromEnrichmentActivity) – All enrichments attending of this user (related name ofattending)enrichments_attended (Reverse
ManyToManyFieldfromEnrichmentActivity) – All enrichments attended of this user (related name ofattended)events_hidden (Reverse
ManyToManyFieldfromEventUserMap) – All events hidden of this user (related name ofusers_hidden)event (Reverse
ForeignKeyfromEvent) – All events of this user (related name ofuser)approved_event (Reverse
ForeignKeyfromEvent) – All approved event of this user (related name ofapproved_by)rejected_event (Reverse
ForeignKeyfromEvent) – All rejected event of this user (related name ofrejected_by)attending (Reverse
ManyToManyFieldfromEvent) – All attending of this user (related name ofattending)tjstaruuidmap (Reverse
ForeignKeyfromTJStarUUIDMap) – All tj star uuid maps of this user (related name ofuser)notificationconfig (Reverse
OneToOneFieldfromNotificationConfig) – The notification config of this user (related name ofuser)gcmnotification (Reverse
ForeignKeyfromGCMNotification) – All gcm notifications of this user (related name ofuser)feedback (Reverse
ForeignKeyfromFeedback) – All feedbacks of this user (related name ofuser)students (Reverse
ForeignKeyfromUser) – All students of this user (related name ofcounselor)properties (Reverse
OneToOneFieldfromUserProperties) – The properties of this user (related name ofuser)dark_mode_properties (Reverse
OneToOneFieldfromUserDarkModeProperties) – The dark mode properties of this user (related name ofuser)emails (Reverse
ForeignKeyfromEmail) – All emails of this user (related name ofuser)phones (Reverse
ForeignKeyfromPhone) – All phones of this user (related name ofuser)websites (Reverse
ForeignKeyfromWebsite) – All websites of this user (related name ofuser)photos (Reverse
ForeignKeyfromPhoto) – All photos of this user (related name ofuser)section (Reverse
ForeignKeyfromSection) – All sections of this user (related name ofteacher)printjob (Reverse
ForeignKeyfromPrintJob) – All print jobs of this user (related name ofuser)answer (Reverse
ForeignKeyfromAnswer) – All answers of this user (related name ofuser)answervote (Reverse
ManyToManyFieldfromAnswerVote) – All answer votes of this user (related name ofusers)senior (Reverse
OneToOneFieldfromSenior) – The senior of this user (related name ofuser)calculatorregistration (Reverse
ForeignKeyfromCalculatorRegistration) – All calculator registrations of this user (related name ofuser)computerregistration (Reverse
ForeignKeyfromComputerRegistration) – All computer registrations of this user (related name ofuser)phoneregistration (Reverse
ForeignKeyfromPhoneRegistration) – All phone registrations of this user (related name ofuser)lostitem (Reverse
ForeignKeyfromLostItem) – All lost items of this user (related name ofuser)founditem (Reverse
ForeignKeyfromFoundItem) – All found items of this user (related name ofuser)senioremailforward (Reverse
ForeignKeyfromSeniorEmailForward) – All senior email forwards of this user (related name ofuser)carapplication (Reverse
ForeignKeyfromCarApplication) – All carapplication of this user (related name ofuser)parkingapplication (Reverse
ForeignKeyfromParkingApplication) – All parkingapplication of this user (related name ofuser)parkingapplication_joint (Reverse
ForeignKeyfromParkingApplication) – All parkingapplication joint of this user (related name ofjoint_user)nomination_votes (Reverse
ForeignKeyfromNomination) – All nomination votes of this user (related name ofnominator)nomination_votes_received (Reverse
ForeignKeyfromNomination) – All nomination votes received of this user (related name ofnominee)trustedsession (Reverse
ForeignKeyfromTrustedSession) – All trusted sessions of this user (related name ofuser)feature_announcements_seen (Reverse
ManyToManyFieldfromFeatureAnnouncement) – All feature announcements seen of this user (related name ofusers_seen)feature_announcements_dismissed (Reverse
ManyToManyFieldfromFeatureAnnouncement) – All feature announcements dismissed of this user (related name ofusers_dismissed)oauth_cslapplication (Reverse
ForeignKeyfromCSLApplication) – All oauth cslapplication of this user (related name ofuser)request (Reverse
ForeignKeyfromRequest) – All requests of this user (related name ofuser)oauth2_provider_grant (Reverse
ForeignKeyfromGrant) – All oauth2 provider grant of this user (related name ofuser)oauth2_provider_accesstoken (Reverse
ForeignKeyfromAccessToken) – All oauth2 provider accesstoken of this user (related name ofuser)oauth2_provider_refreshtoken (Reverse
ForeignKeyfromRefreshToken) – All oauth2 provider refreshtoken of this user (related name ofuser)oauth2_provider_idtoken (Reverse
ForeignKeyfromIDToken) – All oauth2 provider idtoken of this user (related name ofuser)
Methods
Return the user's absence count.
Returns a
QuerySetof the ``EighthSignup``s for which this user was absent.archive_admin_commentsChecks whether this user has permission to edit/manage the given group (either a Group or a group name).
Return the
EighthSponsorthat this user is associated with.Return full name, e.g. Angela William.
get_gender_displayShows the label of the
gender.Get short (first) name of a user.
Returns the user used to authenticate signage displays
get_title_displayShows the label of the
title.get_user_type_displayShows 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_daysdays.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
GENDERTITLESOverride default Model Manager (objects) with
USER_TYPESReturns the
Addressobject representing this user's address, orNoneif it is not set or the current user does not have permission to access it.admin_commentsType:
TextFieldannouncement_setType: Reverse
ForeignKeyfromAnnouncementannouncements_hiddenType: Reverse
ManyToManyFieldfromAnnouncementUserMapannouncements_seenType: Reverse
ManyToManyFieldfromAnnouncementUserMapanswer_setType: Reverse
ForeignKeyfromAnsweranswervote_setType: Reverse
ManyToManyFieldfromAnswerVoteapproved_eventType: Reverse
ForeignKeyfromEventattendingType: Reverse
ManyToManyFieldfromEventbus_routeType:
ForeignKeytoRoutebus_route_idInternal field, use
bus_routeinstead.calculatorregistration_setType: Reverse
ForeignKeyfromCalculatorRegistrationChecks 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.
carapplicationType: Reverse
ForeignKeyfromCarApplicationclub_sponsor_for_setType: Reverse
ManyToManyFieldfromEighthActivitycomputerregistration_setType: Reverse
ForeignKeyfromComputerRegistrationcounselorType:
ForeignKeytoUsercounselor_idInternal field, use
counselorinstead.dark_mode_propertiesType: Reverse
OneToOneFieldfromUserDarkModePropertiesReturns default photo (in binary) that should be used
Returns
self.full_name.eighthactivity_setType: Reverse
ManyToManyFieldfromEighthActivityeighthscheduledactivity_scheduledactivity_setType: Reverse
ManyToManyFieldfromEighthScheduledActivityeighthscheduledactivity_setType: Reverse
ManyToManyFieldfromEighthScheduledActivityeighthsignup_setType: Reverse
ForeignKeyfromEighthSignupeighthwaitlist_setType: Reverse
ForeignKeyfromEighthWaitlistemailsType: Reverse
ForeignKeyfromEmailenable_april_foolsType:
BooleanFieldenrichmentactivity_setType: Reverse
ForeignKeyfromEnrichmentActivityenrichments_attendedType: Reverse
ManyToManyFieldfromEnrichmentActivityenrichments_attendingType: Reverse
ManyToManyFieldfromEnrichmentActivityevent_setType: Reverse
ForeignKeyfromEventevents_hiddenType: Reverse
ManyToManyFieldfromEventUserMapfavorited_activity_setType: Reverse
ManyToManyFieldfromEighthActivityfeature_announcements_dismissedType: Reverse
ManyToManyFieldfromFeatureAnnouncementfeature_announcements_seenType: Reverse
ManyToManyFieldfromFeatureAnnouncementfeedback_setType: Reverse
ForeignKeyfromFeedbackfirst_loginType:
DateTimeFieldfirst_nameType:
CharFieldfounditem_setType: Reverse
ForeignKeyfromFoundItemReturn 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. Angela William.
If the user has a nickname, returns their name in the format "Nickname Lastname." Otherwise, this is identical to full_name.
gcmnotification_setType: Reverse
ForeignKeyfromGCMNotificationgenderType:
CharFieldReturns the grade of a user.
Returns the number of the grade this user is currently in (9, 10, 11, or 12 for students).
graduation_yearType:
IntegerFieldgroupsType:
ManyToManyFieldtoGroupChecks if a
Seniormodel (seeintranet.apps.seniors.models.Seniorexists for the current user.idType:
AutoFieldReturns 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
busadmin 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. eighth office user).
Checks if a user should have access to the Django Admin interface.
Checks if user is a student.
is_superuserType:
BooleanFieldChecks 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_timeType:
DateTimeFieldlast_loginType:
DateTimeFieldlast_nameType:
CharFieldlogentry_setType: Reverse
ForeignKeyfromLogEntrylostitem_setType: Reverse
ForeignKeyfromLostItemmiddle_nameType:
CharFieldnicknameType:
CharFieldnomination_votesType: Reverse
ForeignKeyfromNominationnomination_votes_receivedType: Reverse
ForeignKeyfromNominationReturns the user's first non-TJ email found, or None if none is found.
Returns the notification email.
notificationconfigType: Reverse
OneToOneFieldfromNotificationConfigoauth2_provider_accesstokenType: Reverse
ForeignKeyfromAccessTokenoauth2_provider_grantType: Reverse
ForeignKeyfromGrantoauth2_provider_idtokenType: Reverse
ForeignKeyfromIDTokenoauth2_provider_refreshtokenType: Reverse
ForeignKeyfromRefreshTokenoauth_and_api_accessType:
BooleanFieldoauth_cslapplicationType: Reverse
ForeignKeyfromCSLApplicationobjectsofficer_for_setType: Reverse
ManyToManyFieldfromEighthActivityparkingapplicationType: Reverse
ForeignKeyfromParkingApplicationparkingapplication_jointType: Reverse
ForeignKeyfromParkingApplicationpasswordType:
CharFieldDynamically generate dictionary of privacy options.
phoneregistration_setType: Reverse
ForeignKeyfromPhoneRegistrationphonesType: Reverse
ForeignKeyfromPhonephotosType: Reverse
ForeignKeyfromPhotoposted_byType: Reverse
ForeignKeyfromAnnouncementRequestpreferred_photoType:
OneToOneFieldtoPhotopreferred_photo_idInternal field, use
preferred_photoinstead.primary_emailType:
OneToOneFieldtoEmailprimary_email_addressprimary_email_idInternal field, use
primary_emailinstead.printjob_setType: Reverse
ForeignKeyfromPrintJobpropertiesType: Reverse
OneToOneFieldfromUserPropertiesreceive_eighth_emailsType:
BooleanFieldreceive_news_emailsType:
BooleanFieldreceive_schedule_notificationsType:
BooleanFieldrecommended_activitiesrejected_byType: Reverse
ForeignKeyfromAnnouncementRequestrejected_eventType: Reverse
ForeignKeyfromEventrequest_setType: Reverse
ForeignKeyfromRequestrestricted_activity_setType: Reverse
ManyToManyFieldfromEighthActivityReturns a QuerySet of the
Sectionobjects representing the classes this student is in, orNoneif the current user does not have permission to list this student's classes.section_setType: Reverse
ForeignKeyfromSectionseen_april_foolsType:
BooleanFieldseen_welcomeType:
BooleanFieldseniorType: Reverse
OneToOneFieldfromSeniorsenioremailforward_setType: Reverse
ForeignKeyfromSeniorEmailForwardReturns the gender of this user (male, female, or non-binary).
Return short name (first name) of a user.
sponsor_objType: Reverse
OneToOneFieldfromEighthSponsorsticky_scheduledactivity_setType: Reverse
ManyToManyFieldfromEighthScheduledActivitystudent_idType:
CharFieldstudentsType: Reverse
ForeignKeyfromUsersubscribed_activity_setType: Reverse
ManyToManyFieldfromEighthActivityteachers_approvedType: Reverse
ManyToManyFieldfromAnnouncementRequestteachers_requestedType: Reverse
ManyToManyFieldfromAnnouncementRequesttitleType:
CharFieldGet (or guess) a user's TJ email.
tjstaruuidmap_setType: Reverse
ForeignKeyfromTJStarUUIDMaptrustedsession_setType: Reverse
ForeignKeyfromTrustedSessionuserType: Reverse
ForeignKeyfromAnnouncementRequestuser_lockedType:
BooleanFielduser_permissionsType:
ManyToManyFieldtoPermissionuser_typeType:
CharFieldusernameType:
CharFieldwebsitesType: Reverse
ForeignKeyfromWebsite- 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
QuerySetof the ``EighthSignup``s for which this user was absent.- Returns:
A
QuerySetof the ``EighthSignup``s for which this user was absent.
- property address: Address | None¶
Returns the
Addressobject representing this user’s address, orNoneif it is not set or the current user does not have permission to access it.- Returns:
The
Addressrepresenting this user’s address, orNoneif 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
EighthSponsorthat this user is associated with.- Returns:
The
EighthSponsorthat 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_nameandfirst_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
Seniormodel (seeintranet.apps.seniors.models.Seniorexists for the current user.- Returns:
Whether a
Seniormodel (seeintranet.apps.seniors.models.Seniorexists 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
busadmin permission.- Returns:
Whether the user has the
busadmin 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.EighthSponsorand, 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
Groupobject.- 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
Sectionobjects representing the classes this student is in, orNoneif the current user does not have permission to list this student’s classes.- Returns:
Returns a QuerySet of the
Sectionobjects representing the classes this student is in, orNoneif 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_daysdays. 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_daysdays. 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.