UserManager

Qualified name: intranet.apps.users.models.UserManager

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.

Methods

exclude_from_search

get_approve_announcements_users

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

get_approve_announcements_users_sorted

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

get_students

Get user objects that are students (quickly).

get_teachers

Get user objects that are teachers (quickly).

get_teachers_attendance_users

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

get_teachers_attendance_users_sorted

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

get_teachers_sorted

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

user_with_ion_id

Get a unique user object by Ion ID.

user_with_name

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

user_with_student_id

Get a unique user object by FCPS student ID.

users_in_year

Get a list of users in a specific graduation year.

Attributes

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() Collection[User] | QuerySet[source]

Get user objects that are students (quickly).

get_teachers() 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() 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: int | str) User | None[source]

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

user_with_name(given_name: str | None = None, last_name: str | None = 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: int | str) User | None[source]

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

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

Get a list of users in a specific graduation year.