intranet.apps.users package¶
Submodules¶
intranet.apps.users.admin module¶
intranet.apps.users.api module¶
-
class
intranet.apps.users.api.
ProfileDetail
(**kwargs)[source]¶ Bases:
rest_framework.generics.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'>,)¶
-
serializer_class
¶
-
-
class
intranet.apps.users.api.
ProfilePictureDetail
(**kwargs)[source]¶ Bases:
rest_framework.generics.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'>,)¶
-
serializer_class
¶
-
-
class
intranet.apps.users.api.
Search
(**kwargs)[source]¶ Bases:
rest_framework.generics.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.DenyRestrictedPermission'>,)¶
-
queryset
¶
-
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:
django.forms.models.ModelForm
Form for user address
-
class
Meta
[source]¶ Bases:
object
-
fields
= ['street', 'city', 'state', 'postal_code']¶
-
model
¶ alias of
intranet.apps.users.models.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
-
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:
django.forms.models.ModelForm
A form containing editable fields in the User model.
-
GENDERS
= ((True, 'Male'), (False, 'Female'))¶
-
class
Meta
[source]¶ Bases:
object
-
fields
= ['admin_comments', 'student_id', 'first_name', 'middle_name', 'last_name', 'title', 'nickname', 'graduation_year', 'gender']¶
-
model
¶ alias of
intranet.apps.users.models.User
-
-
declared_fields
= {'admin_comments': <django.forms.fields.CharField object>, 'birthday': <django.forms.fields.DateField 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:
django.forms.models.ModelMultipleChoiceField
A ModelMultipleChoiceField that returns a user’s Last, First initial instead of their TJ username (which is the default string representation).
-
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, **kwargs)[source]¶ Bases:
django.forms.models.ModelChoiceField
A ModelChoiceField that returns a user’s Last, First name instead of their TJ username (which is the default string representation).
-
class
intranet.apps.users.forms.
SortedUserMultipleChoiceField
(queryset, **kwargs)[source]¶ Bases:
django.forms.models.ModelMultipleChoiceField
A ModelMultipleChoiceField that returns a user’s Last, First name instead of their TJ username (which is the default string representation).
-
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, **kwargs)[source]¶ Bases:
django.forms.models.ModelChoiceField
A ModelChoiceField that returns a user’s full name instead of their TJ username (which is the default string representation).
intranet.apps.users.models module¶
-
class
intranet.apps.users.models.
Address
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.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.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
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 aReverseOneToOneDescriptor
instance.
-
-
class
intranet.apps.users.models.
Course
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a course at TJ (not to be confused with section)
-
exception
DoesNotExist
¶
-
exception
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
intranet.apps.users.models.
Email
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents an email address
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
Grade
(graduation_year)[source]¶ Bases:
object
Represents a user’s grade.
-
property
name
¶ Return the grade’s name (e.g. senior)
-
property
name_plural
¶ Return the grade’s plural name (e.g. freshmen)
-
names
= ['freshman', 'sophomore', 'junior', 'senior', 'staff']¶
-
property
number
¶ 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.
-
property
text
¶ Return the grade’s number as a string (e.g. Grade 12, Graduate)
-
property
-
class
intranet.apps.users.models.
Phone
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a phone number
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
Photo
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a user photo
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
Section
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a section - a class with teacher, period, and room assignments
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
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.
-
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 aForwardManyToOneDescriptor
instance.
-
teacher_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
User
(*args, **kwargs)[source]¶ Bases:
django.contrib.auth.base_user.AbstractBaseUser
,django.contrib.auth.models.PermissionsMixin
Django User model subclass
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
TITLES
= (('mr', 'Mr.'), ('ms', 'Ms.'), ('mrs', 'Mrs.'), ('dr', 'Dr.'))¶
-
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
¶ Returns the
Address
object representing this user’s address, orNone
if it is not set or the current user does not have permission to access it.- Returns
The
Address
representing this user’s address, orNone
if that is unavailable to the current user.
-
admin_comments
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
property
age
¶ Returns a user’s age, based on their birthday.
- Returns
The user’s age as an integer, or None if their birthday is not set.
-
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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 aReverseManyToOneDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
property
birthday
¶ Returns a
datetime.date
representing this user’s birthday, orNone
if it is not set or the current user does not have permission to access it.- Returns
A
datetime.date
representing this user’s birthday, orNone
if it is not set or the current user does not have permission to access it.
-
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 aForwardManyToOneDescriptor
instance.
-
bus_route_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
property
can_request_parking
¶ 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
¶ Checks if a user has the show_eighth permission.
- Returns
Whether this user has made their eighth period signups public.
-
property
can_view_phone
¶ 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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aForwardManyToOneDescriptor
instance.
-
counselor_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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 aReverseOneToOneDescriptor
instance.
-
property
default_photo
¶ Returns default photo (in binary) that should be used
- Returns
The binary representation of the user’s default photo.
-
property
display_name
¶ 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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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 aReverseManyToOneDescriptor
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 aReverseOneToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
instance.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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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
¶ 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
¶ 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 aReverseManyToOneDescriptor
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_short_name
() → str[source]¶ Get short (first) name of a user.
- Returns
The user’s first name (see
short_name
andfirst_name
).
-
static
get_signage_user
() → intranet.apps.users.models.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
¶ Returns the grade of a user.
- Returns
A Grade object representing the uset’s current grade.
-
property
grade_number
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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
¶ Checks if user has the admin permission ‘printing’.
- Returns
Whether this user is a printing administrator.
-
property
has_senior
¶ Checks if a
Senior
model (seeintranet.apps.seniors.models.Senior
exists for the current user.- Returns
Whether a
Senior
model (seeintranet.apps.seniors.models.Senior
exists for the current user.
-
has_unvoted_polls
() → bool[source]¶ Returns whether there are open polls thet this user has not yet voted in.
- Returns
Whether there are open polls thet this user has not yet voted in.
-
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
¶ Returns this user’s username.
- Returns
This user’s username (see
username
).
-
property
is_active
¶ 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
¶ Checks if user is an alumnus.
- Returns
Whether this user is an alumnus.
-
property
is_announcements_admin
¶ Checks if user is an announcements admin.
- Returns
Whether this user is an announcement admin.
-
property
is_attendance_taker
¶ 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
¶ Checks if user is an attendance-only user.
- Returns
Whether this user is an attendance-only user.
-
property
is_board_admin
¶ Checks if user is a board admin.
- Returns
Whether this user is a board admin.
-
property
is_bus_admin
¶ Returns whether the user has the
bus
admin permission.- Returns
Whether the user has the
bus
admin permission.
-
property
is_eighth_admin
¶ Checks if user is an eighth period admin.
- Returns
Whether this user is an eighth period admin.
-
property
is_eighth_sponsor
¶ 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
¶ 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_female
¶ Returns whether the user is female.
- Returns
Whether the user is female.
-
property
is_male
¶ Returns whether the user is male.
- Returns
Whether the user is male.
-
property
is_parking_admin
¶ Checks if user has the admin permission ‘parking’.
- Returns
Whether this user is a parking administrator.
-
property
is_restricted
¶ 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
¶ Checks if user is a schedule admin.
- Returns
Whether this user is a schedule admin.
-
property
is_senior
¶ Checks if user is a student in Grade 12.
- Returns
Whether this user is a senior.
-
property
is_simple_user
¶ 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
¶ 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
¶ Checks if user is a student.
- Returns
Whether this user is a student.
-
property
is_teacher
¶ Checks if user is a teacher.
- Returns
Whether this user is a teacher.
-
property
last_first
¶ Return a name in the format of: Lastname, Firstname [(Nickname)]
-
property
last_first_id
¶ Return a name in the format of: Lastname, Firstname [(Nickname)] (Student ID/ID/Username)
-
property
last_first_initial
¶ 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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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[intranet.apps.groups.models.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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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
¶ 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
¶ 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 aReverseOneToOneDescriptor
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 aReverseManyToOneDescriptor
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_application
¶ 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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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
¶ 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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aForwardOneToOneDescriptor
instance.
-
preferred_photo_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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 aForwardOneToOneDescriptor
instance.
-
property
primary_email_address
¶
-
primary_email_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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 aReverseManyToOneDescriptor
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 aReverseOneToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
¶ Returns a QuerySet of the
Section
objects representing the classes this student is in, orNone
if the current user does not have permission to list this student’s classes.- Returns
Returns a QuerySet of the
Section
objects representing the classes this student is in, orNone
if the current user does not have permission to list this student’s classes.
-
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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 aReverseOneToOneDescriptor
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 aReverseManyToOneDescriptor
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
¶ Returns “Male” if this user is male, “Female” otherwise.
- Returns
“Male” if this user is male, “Female” otherwise.
-
property
short_name
¶ Return short name (first name) of a user.
This is required for subclasses of User.
- Returns
The user’s fist name.
-
signed_up_next_few_days
(*, num_days: int = 3) → bool[source]¶ If the user is a student, returns whether they are signed up for an activity during all eighth period blocks in the next
num_days
days. Otherwise, returnsTrue
.Today is counted as a day, so
signed_up_few_next_day(num_days=1)
is equivalent tosigned_up_today()
.- Parameters
num_days – The number of days (including today) on which to search for blocks during which the user is signed up.
- Returns
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks in the next
num_days
days. Otherwise, returnsTrue
.
-
signed_up_today
() → bool[source]¶ If the user is a student, returns whether they are signed up for an activity during all eighth period blocks that are scheduled today. Otherwise, returns
True
.- Returns
If the user is a student, returns whether they are signed up for an activity during all eighth period blocks that are scheduled today. Otherwise, returns
True
.
-
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 aReverseManyToOneDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
¶ 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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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 aReverseManyToOneDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
intranet.apps.users.models.
UserDarkModeProperties
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Contains user properties relating to dark mode
-
exception
DoesNotExist
¶
-
exception
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 aForwardOneToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
UserManager
[source]¶ Bases:
django.contrib.auth.models.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.
-
exclude_from_search
(existing_queryset: Union[Collection[get_user_model()], django.db.models.query.QuerySet, None] = None) → Union[Collection[intranet.apps.users.models.User], django.db.models.query.QuerySet][source]¶
-
get_students
() → Union[Collection[intranet.apps.users.models.User], django.db.models.query.QuerySet][source]¶ Get user objects that are students (quickly).
-
get_teachers
() → Union[Collection[intranet.apps.users.models.User], django.db.models.query.QuerySet][source]¶ Get user objects that are teachers (quickly).
-
get_teachers_attendance_users
() → QuerySet[get_user_model()][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[get_user_model()][source]¶ Returns a
QuerySet
containing both teachers and attendance-only users sorted by last name, then first name.This is used for the announcement request page.
- Returns
A
QuerySet
of teachers sorted by last name, then first name.
-
get_teachers_sorted
() → Union[Collection[intranet.apps.users.models.User], django.db.models.query.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[get_user_model()][source]¶ Get a unique user object by Ion ID. (Ex. 489)
-
user_with_name
(given_name: Optional[str] = None, last_name: Optional[str] = None) → intranet.apps.users.models.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[get_user_model()][source]¶ Get a unique user object by FCPS student ID. (Ex. 1624472)
-
users_in_year
(year: int) → Union[Collection[intranet.apps.users.models.User], django.db.models.query.QuerySet][source]¶ Get a list of users in a specific graduation year.
-
users_with_birthday
(month: int, day: int) → Union[Collection[intranet.apps.users.models.User], django.db.models.query.QuerySet][source]¶ Return a
QuerySet
of user objects who have a birthday on a given date and have made their birthday public.- Parameters
month – The month to check for a birthday.
day – The day to chack for a birthday.
- Returns
A
QuerySet
of user objects who have a birthday on a given date and have made their birthday public.
-
-
class
intranet.apps.users.models.
UserProperties
(id, user, _address, _birthday, self_show_pictures, parent_show_pictures, self_show_address, parent_show_address, self_show_telephone, parent_show_telephone, self_show_birthday, parent_show_birthday, self_show_eighth, parent_show_eighth, self_show_schedule, parent_show_schedule)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
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_birthday
¶ 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_birthday
¶ 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
isTrue
andvalue
isFalse
, both the parent and the student’s permissions will be set toFalse
.admin – If set to
True
, this will allow changing the student’s permission even if the parent’s permission is set toFalse
(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 aForwardOneToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
UserProperties__schedule
(id, userproperties, section)¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
section_id
¶ 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 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 aForwardManyToOneDescriptor
instance.
-
userproperties_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
User_groups
(id, user, group)¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
group_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.
-
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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
User_user_permissions
(id, user, permission)¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
permission_id
¶ 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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
intranet.apps.users.models.
Website
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a user’s website
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
intranet.apps.users.renderers module¶
intranet.apps.users.serializers module¶
-
class
intranet.apps.users.serializers.
AddressSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
intranet.apps.users.serializers.
CounselorTeacherSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.HyperlinkedModelSerializer
-
class
intranet.apps.users.serializers.
GradeSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.Serializer
-
class
intranet.apps.users.serializers.
HyperlinkedImageField
(view_name=None, **kwargs)[source]¶ Bases:
rest_framework.relations.HyperlinkedIdentityField
-
class
intranet.apps.users.serializers.
StudentSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.HyperlinkedModelSerializer
-
class
intranet.apps.users.serializers.
UserSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.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', 'birthday', 'user_type', 'phones', 'websites', 'counselor', 'address', 'picture', 'is_eighth_admin', 'is_announcements_admin', 'is_teacher', 'is_student', 'absences')¶
-
model
¶ alias of
intranet.apps.users.models.User
-
-
class