intranet.apps.users package

Subpackages

Submodules

intranet.apps.users.admin module

class intranet.apps.users.admin.UserAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('username', 'first_name', 'middle_name', 'last_name', 'nickname', 'user_type', 'is_superuser', 'user_active')
list_filter = ('graduation_year', 'user_type', 'is_superuser', 'user_locked', 'gender', 'oauth_and_api_access', 'receive_news_emails', 'receive_eighth_emails', 'receive_schedule_notifications', 'bus_route', 'counselor')
search_fields = ('username', 'first_name', 'middle_name', 'last_name', 'nickname', 'student_id')
user_active(obj)[source]

intranet.apps.users.api module

class intranet.apps.users.api.ProfileDetail(**kwargs)[source]

Bases: RetrieveAPIView

API endpoint that retrieves an Ion profile.

/api/profile: retrieve your profile /api/profile/<pk>: retrieve the profile of the user with id <pk> /api/profile/<username>: retrieve the profile of the user with username <username>

permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)
retrieve(request, *args, **kwargs)[source]
serializer_class

alias of UserSerializer

class intranet.apps.users.api.ProfilePictureDetail(**kwargs)[source]

Bases: RetrieveAPIView

API endpoint that retrieves an Ion profile picture.

/api/profile/<pk>/picture: retrieve default profile picture /api/profile/<pk>/picture/<photo_year>: retrieve profile picture for year <photo_year>

permission_classes = (<class 'intranet.apps.auth.rest_permissions.DenyRestrictedPermission'>,)
renderer_classes = (<class 'intranet.apps.users.renderers.JPEGRenderer'>,)
retrieve(request, *args, **kwargs)[source]
serializer_class

alias of UserSerializer

class intranet.apps.users.api.Search(**kwargs)[source]

Bases: RetrieveAPIView

API endpoint that retrieves the results of a search for Ion users.

Paginated using ?page=<page>

permission_classes = (<class 'intranet.apps.auth.rest_permissions.ApiAndOauthPermission'>,)
queryset
retrieve(request, *args, **kwargs)[source]

intranet.apps.users.courses_urls module

intranet.apps.users.forms module

class intranet.apps.users.forms.AddressForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Form for user address

class Meta[source]

Bases: object

fields = ['street', 'city', 'state', 'postal_code']
model

alias of Address

declared_fields = {'city': <django.forms.fields.CharField object>, 'postal_code': <django.forms.fields.CharField object>, 'state': <django.forms.fields.CharField object>, 'street': <django.forms.fields.CharField object>}
class intranet.apps.users.forms.ProfileEditForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

A form containing editable fields in the User model.

GENDERS = (('male', 'Male'), ('female', 'Female'), ('non-binary', 'Non-Binary'))
class Meta[source]

Bases: object

fields = ['admin_comments', 'student_id', 'first_name', 'middle_name', 'last_name', 'title', 'nickname', 'graduation_year', 'gender']
model

alias of User

declared_fields = {'admin_comments': <django.forms.fields.CharField object>, 'counselor_id': <django.forms.fields.IntegerField object>, 'first_name': <django.forms.fields.CharField object>, 'gender': <django.forms.fields.ChoiceField object>, 'graduation_year': <django.forms.fields.IntegerField object>, 'last_name': <django.forms.fields.CharField object>, 'middle_name': <django.forms.fields.CharField object>, 'nickname': <django.forms.fields.CharField object>, 'student_id': <django.forms.fields.IntegerField object>}
class intranet.apps.users.forms.SortedTeacherMultipleChoiceField(*args, **kwargs)[source]

Bases: ModelMultipleChoiceField

A ModelMultipleChoiceField that returns a user’s Last, First initial instead of their TJ username (which is the default string representation).

label_from_instance(obj)[source]
class intranet.apps.users.forms.SortedUserChoiceField(queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, blank=False, **kwargs)[source]

Bases: ModelChoiceField

A ModelChoiceField that returns a user’s Last, First name instead of their TJ username (which is the default string representation).

label_from_instance(obj)[source]
class intranet.apps.users.forms.SortedUserMultipleChoiceField(queryset, **kwargs)[source]

Bases: ModelMultipleChoiceField

A ModelMultipleChoiceField that returns a user’s Last, First name instead of their TJ username (which is the default string representation).

label_from_instance(obj)[source]
class intranet.apps.users.forms.UserChoiceField(queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, blank=False, **kwargs)[source]

Bases: ModelChoiceField

A ModelChoiceField that returns a user’s full name instead of their TJ username (which is the default string representation).

label_from_instance(obj)[source]
class intranet.apps.users.forms.UserMultipleChoiceField(queryset, **kwargs)[source]

Bases: ModelMultipleChoiceField

A ModelMultipleChoiceField that returns a user’s full name instead of their TJ username (which is the default string representation).

label_from_instance(obj)[source]

intranet.apps.users.models module

class intranet.apps.users.models.Address(*args, **kwargs)[source]

Bases: Model

Represents a user’s address.

street

The street name of the address.

city

The city name of the address.

state

The state name of the address.

postal_code

The zip code of the address.

NOTE: This model is no longer used because of privacy reasons.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

__str__()[source]

Returns full address string.

city

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
postal_code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

street

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

userproperties

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class intranet.apps.users.models.Course(*args, **kwargs)[source]

Bases: Model

Represents a course at TJ (not to be confused with section)

NOTE: This model is no longer used because of privacy reasons.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

course_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
sections

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class intranet.apps.users.models.Email(*args, **kwargs)[source]

Bases: Model

Represents an email address

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

address

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.users.models.Grade(graduation_year)[source]

Bases: object

Represents a user’s grade.

__int__()[source]

Return the grade as a number (9-12).

__str__()[source]

Return name of the grade.

classmethod grade_from_year(graduation_year: int) int[source]
property name: str

Return the grade’s name (e.g. senior)

property name_plural: str

Return the grade’s plural name (e.g. freshmen)

names = ['freshman', 'sophomore', 'junior', 'senior', 'staff']
property number: int

Return the grade as a number (9-12).

For use in templates since there is no nice integer casting. In Python code you can also use int() on a Grade object.

static number_from_name(name: str) Optional[int][source]
property text: str

Return the grade’s number as a string (e.g. Grade 12, Graduate)

classmethod year_from_grade(grade: int) int[source]
class intranet.apps.users.models.Phone(*args, **kwargs)[source]

Bases: Model

Represents a phone number

NOTE: This model is no longer used because of privacy reasons.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

PURPOSES = (('h', 'Home Phone'), ('m', 'Mobile Phone'), ('o', 'Other Phone'))
get_purpose_display(*, field=<django.db.models.fields.CharField: purpose>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
purpose

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.users.models.Photo(*args, **kwargs)[source]

Bases: Model

Represents a user photo

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

base64

Returns base64 encoded binary data for a user’s picture.

Returns:

Base 64-encoded binary data for a user’s picture.

get_grade_number_display(*, field=<django.db.models.fields.IntegerField: grade_number>)
grade_number

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.users.models.Section(*args, **kwargs)[source]

Bases: Model

Represents a section - a class with teacher, period, and room assignments

NOTE: This model is no longer used because of privacy reasons.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

course

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

course_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
period

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

room

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

section_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sem

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

teacher

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

teacher_id
class intranet.apps.users.models.User(*args, **kwargs)[source]

Bases: AbstractBaseUser, PermissionsMixin

Django User model subclass

exception DoesNotExist

Bases: ObjectDoesNotExist

GENDER = (('male', 'Male'), ('female', 'Female'), ('non-binary', 'Non-Binary'))
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

TITLES = (('mr', 'Mr.'), ('ms', 'Ms.'), ('mrs', 'Mrs.'), ('dr', 'Dr.'), ('mx', 'Mx.'))
USERNAME_FIELD = 'username'

Override default Model Manager (objects) with custom UserManager to add table-level functionality.

USER_TYPES = (('student', 'Student'), ('teacher', 'Teacher'), ('counselor', 'Counselor'), ('user', 'Attendance-Only User'), ('simple_user', 'Simple User'), ('tjstar_presenter', 'tjStar Presenter'), ('alum', 'Alumnus'), ('service', 'Service Account'))
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: Optional[Address]

Returns the Address object representing this user’s address, or None if it is not set or the current user does not have permission to access it.

Returns:

The Address representing this user’s address, or None if that is unavailable to the current user.

admin_comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

announcement_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

announcements_hidden

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

announcements_seen

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

answer_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

answervote_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

approved_event

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

archive_admin_comments()[source]
attending

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

bus_route

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

bus_route_id
calculatorregistration_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

can_manage_group(group: Union[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.

carapplication

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

computerregistration_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

counselor

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

counselor_id
dark_mode_properties

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property default_photo: Optional[bytes]

Returns default photo (in binary) that should be used

Returns:

The binary representation of the user’s default photo.

property display_name: str

Returns self.full_name.

Returns:

The user’s full name.

eighthactivity_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

eighthscheduledactivity_scheduledactivity_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

eighthscheduledactivity_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

eighthsignup_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

eighthsponsor

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

eighthwaitlist_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

emails

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

enable_april_fools

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

enrichmentactivity_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

enrichments_attended

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

enrichments_attending

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

event_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

events_hidden

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

favorited_activity_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

feature_announcements_dismissed

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

feature_announcements_seen

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

feedback_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

first_login

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

first_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

founditem_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

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.

gcmnotification_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

gender

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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_gender_display(*, field=<django.db.models.fields.CharField: gender>)
get_short_name() str[source]

Get short (first) name of a user.

Returns:

The user’s first name (see short_name and first_name).

static get_signage_user() User[source]

Returns the user used to authenticate signage displays

Returns:

The user used to authenticate signage displays

get_title_display(*, field=<django.db.models.fields.CharField: title>)
get_user_type_display(*, field=<django.db.models.fields.CharField: user_type>)
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.

graduation_year

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

handle_delete()[source]

Handle a graduated user being deleted.

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_print_permission: bool

Checks if user has the admin permission ‘printing’.

Returns:

Whether this user is a printing administrator.

property has_senior: bool

Checks if a Senior model (see intranet.apps.seniors.models.Senior exists for the current user.

Returns:

Whether a Senior model (see intranet.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.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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_alum: bool

Checks if user is an alumnus.

Returns:

Whether this user is an alumnus.

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_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_female: bool

Returns whether the user is female.

Returns:

Whether this user is female.

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_male: bool

Returns whether the user is male.

Returns:

Whether this user is male.

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_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 is_student: bool

Checks if user is a student.

Returns:

Whether this user is a student.

property is_teacher: bool

Checks if user is a teacher.

Returns:

Whether this user is a teacher.

property last_first: str

Return a name in the format of: Lastname, Firstname [(Nickname)]

property last_first_id: str

Return a name in the format of: Lastname, Firstname [(Nickname)] (Student ID/ID/Username)

property last_first_initial: str

Return a name in the format of: Lastname, F [(Nickname)]

last_global_logout_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

logentry_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

lostitem_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

member_of(group: Union[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.

middle_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nickname

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nomination_votes

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

nomination_votes_received

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property non_tj_email: Optional[str]

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.

notificationconfig

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

oauth2_provider_accesstoken

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

oauth2_provider_grant

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

oauth2_provider_idtoken

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

oauth2_provider_refreshtoken

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

oauth_and_api_access

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

oauth_cslapplication

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <intranet.apps.users.models.UserManager object>
parkingapplication

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

parkingapplication_joint

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

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.

phoneregistration_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

phones

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

photos

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

posted_by

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

preferred_photo

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

preferred_photo_id
primary_email

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

property primary_email_address: Optional[str]
primary_email_id
printjob_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

properties

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

receive_eighth_emails

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

receive_news_emails

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

receive_schedule_notifications

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property recommended_activities
rejected_by

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

rejected_event

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

request_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

restricted_activity_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property schedule: Optional[Union[QuerySet, Collection[Section]]]

Returns a QuerySet of the Section objects representing the classes this student is in, or None 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, or None if the current user does not have permission to list this student’s classes.

section_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

seen_april_fools

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

seen_welcome

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

senior

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

senioremailforward_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

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.

should_see_polls() bool[source]

Returns whether the user should have the Polls icon visible

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, returns True.

Today is counted as a day, so signed_up_few_next_day(num_days=1) is equivalent to signed_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, returns True.

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.

student_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

students

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

teachers_approved

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

teachers_requested

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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.

tjstaruuidmap_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

trustedsession_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

user

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

user_locked

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user_permissions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

user_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

username

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

websites

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class intranet.apps.users.models.UserDarkModeProperties(*args, **kwargs)[source]

Bases: Model

Contains user properties relating to dark mode

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

dark_mode_enabled

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
user

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

user_id
class intranet.apps.users.models.UserManager(*args, **kwargs)[source]

Bases: UserManager

User model Manager for table-level User queries.

Provides an abstraction for the User model. If a call to a method fails for this Manager, the call is deferred to the default User model manager.

get_approve_announcements_users() QuerySet[source]

Returns a QuerySet containing all users except simple users, tjstar presenters, alumni, service users and students.

Returns:

A QuerySet of all users except simple users, tjstar presenters, alumni, service users and students.

get_approve_announcements_users_sorted() QuerySet[source]

Returns a QuerySet containing all users except simple users, tjstar presenters, alumni, service users and students sorted by last name, then first name.

This is used for the announcement request page.

Returns:

A QuerySet of all users except simple users, tjstar presenters, alumni, service users and students sorted by last name, then first name.

get_students() Union[Collection[User], QuerySet][source]

Get user objects that are students (quickly).

get_teachers() Union[Collection[User], QuerySet][source]

Get user objects that are teachers (quickly).

get_teachers_attendance_users() QuerySet[source]

Like get_teachers(), but includes attendance-only users as well as teachers.

Returns:

A QuerySet of users who are either teachers or attendance-only users.

get_teachers_attendance_users_sorted() QuerySet[source]

Returns a QuerySet containing both teachers and attendance-only users sorted by last name, then first name.

Returns:

A QuerySet of teachers sorted by last name, then first name.

get_teachers_sorted() Union[Collection[User], QuerySet][source]

Returns a QuerySet of teachers sorted by last name, then first name.

Returns:

A QuerySet of teachers sorted by last name, then first name.

user_with_ion_id(student_id: Union[int, str]) Optional[User][source]

Get a unique user object by Ion ID. (Ex. 489)

user_with_name(given_name: Optional[str] = None, last_name: Optional[str] = None) User[source]

Get a unique user object by given name (first/nickname) and/or last name.

Parameters:
  • given_name – If given, users will be filtered to those who have either this first name or this nickname.

  • last_name – If given, users will be filtered to those who have this last name.

Returns:

The unique user object returned by filtering for the given first name/nickname and/or last name. Returns None if no results were returned or if the given parameters matched more than one user.

user_with_student_id(student_id: Union[int, str]) Optional[User][source]

Get a unique user object by FCPS student ID. (Ex. 1624472)

users_in_year(year: int) Union[Collection[User], QuerySet][source]

Get a list of users in a specific graduation year.

class intranet.apps.users.models.UserProperties(id, user, _address, self_show_pictures, parent_show_pictures, self_show_address, parent_show_address, self_show_telephone, parent_show_telephone, self_show_eighth, parent_show_eighth, self_show_schedule, parent_show_schedule)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

attribute_is_public(permission: str) bool[source]

Checks if attribute is visible to public (ignoring whether the user sending the HTTP request has permission to access it).

Parameters:

permission – The name of the permission to check.

Returns:

Whether the given permission is public.

attribute_is_visible(permission: str) bool[source]

Checks privacy options to see if an attribute is visible to the user sending the current HTTP request.

Parameters:

permission – The name of the permission to check.

Returns:

Whether the user sending the current HTTP request has permission to view the given permission.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_http_request_sender() bool[source]

Checks if a user the HTTP request sender (accessing own info)

Used primarily to load private personal information from the cache. (A student should see all info on his or her own profile regardless of how the permissions are set.)

Returns:

Whether the user is the sender of the current HTTP request.

objects = <django.db.models.manager.Manager object>
parent_show_address

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parent_show_eighth

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parent_show_pictures

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parent_show_schedule

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parent_show_telephone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

self_show_address

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

self_show_eighth

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

self_show_pictures

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

self_show_schedule

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

self_show_telephone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

set_permission(permission: str, value: bool, parent: bool = False, admin: bool = False) bool[source]

Sets permission for personal information.

Returns False silently if unable to set permission. Returns True if successful.

Parameters:
  • permission – The name of the permission to set.

  • value – The value to set the permission to.

  • parent – Whether to set the parent’s permission instead of the student’s permission. If parent is True and value is False, both the parent and the student’s permissions will be set to False.

  • admin – If set to True, this will allow changing the student’s permission even if the parent’s permission is set to False (normally, this causes an error).

user

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

user_id
class intranet.apps.users.models.UserProperties__schedule(id, userproperties, section)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
section

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

section_id
userproperties

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

userproperties_id
class intranet.apps.users.models.User_groups(id, user, group)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

group

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

group_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.users.models.User_user_permissions(id, user, permission)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
permission

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

permission_id
user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class intranet.apps.users.models.Website(*args, **kwargs)[source]

Bases: Model

Represents a user’s website

NOTE: This model is no longer used because of privacy reasons.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id

intranet.apps.users.renderers module

class intranet.apps.users.renderers.JPEGRenderer[source]

Bases: BaseRenderer

Renders binary JPEG data.

charset: str = None
format = 'jpg'
media_type = 'image/jpg'
render(data, accepted_media_type=None, renderer_context=None)[source]
render_style = 'binary'

intranet.apps.users.serializers module

class intranet.apps.users.serializers.AddressSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

class Meta[source]

Bases: object

fields = ('street', 'city', 'state', 'postal_code')
model

alias of Address

class intranet.apps.users.serializers.CounselorTeacherSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'url', 'user_type', 'username', 'full_name', 'first_name', 'last_name')
model

alias of User

class intranet.apps.users.serializers.GradeSerializer(*args, **kwargs)[source]

Bases: Serializer

class intranet.apps.users.serializers.HyperlinkedImageField(*args, **kwargs)[source]

Bases: HyperlinkedIdentityField

get_url(obj, view_name, request, format)[source]
class intranet.apps.users.serializers.StudentSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'url', 'user_type', 'username', 'full_name', 'first_name', 'last_name', 'grade')
model

alias of User

class intranet.apps.users.serializers.UserSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'ion_username', 'sex', 'title', 'display_name', 'full_name', 'short_name', 'first_name', 'middle_name', 'last_name', 'nickname', 'tj_email', 'emails', 'grade', 'graduation_year', 'user_type', 'phones', 'websites', 'counselor', 'address', 'picture', 'is_eighth_admin', 'is_announcements_admin', 'is_teacher', 'is_student', 'absences')
model

alias of User

intranet.apps.users.tests module

class intranet.apps.users.tests.CourseTest(methodName='runTest')[source]

Bases: IonTestCase

create_schedule_test()[source]
setUp()[source]
test_all_courses_view()[source]
test_course_info_view()[source]
test_courses_by_period_view()[source]
test_section_course_attributes()[source]
test_section_view()[source]
test_sections_by_room_view()[source]
class intranet.apps.users.tests.ProfileTest(methodName='runTest')[source]

Bases: IonTestCase

make_token()[source]
setUp()[source]
test_get_profile_api()[source]
test_get_profile_picture_api()[source]
test_privacy_options()[source]
test_profile_view()[source]
class intranet.apps.users.tests.UserTest(methodName='runTest')[source]

Bases: IonTestCase

test_get_signage_user()[source]
test_get_teachers()[source]
test_has_unvoted_polls()[source]
test_male_female()[source]

Tests all possible values of is_male/is_female.

test_name()[source]
test_notification_email()[source]
test_signed_up_next_few_days()[source]
test_signed_up_today()[source]
test_tj_email_non_tj_email()[source]
test_user_with_name()[source]

intranet.apps.users.urls module

intranet.apps.users.views module

intranet.apps.users.views.picture_view(request, user_id, year=None)[source]

Displays a view of a user’s picture.

Parameters:
  • user_id (str) – The ID of the user whose picture is being fetched.

  • year (str) – The user’s picture from this year is fetched. If not specified, use the preferred picture.

intranet.apps.users.views.profile_view(request, user_id=None)[source]

Displays a view of a user’s profile.

Parameters:

user_id – The ID of the user whose profile is being viewed. If not specified, show the user’s own profile.

Module contents