AssignmentQuerySet¶
Qualified name: tin.apps.assignments.models.AssignmentQuerySet
- class AssignmentQuerySet(model=None, query=None, using=None, hints=None)[source]¶
Bases:
QuerySet
Methods
Filters assignments if they're editable by the user
Filters based off of the permissions of the user and the course.
Filters by assignments that can be submitted.
Filters assignments that are visible to a user
Attributes
- filter_permissions(user, *perms: Literal['-', 'r', 'w'])[source]¶
Filters based off of the permissions of the user and the course.
An admin can always see everything. A teacher can only see courses they are the teachers for. Otherwise it filters it based off the course being archived and/or the permission of the course after archiving.
- Parameters:
user – The user executing the query (
request.user
)*perms – Every permission listed is or-ed together. Each value can be - (hidden), r (read-only), or w (read-write)
- filter_submittable(user)[source]¶
Filters by assignments that can be submitted.
Warning
Do NOT use this if
is_quiz
isTrue
. In that case, the check should be done manually.
- filter_visible(user)[source]¶
Filters assignments that are visible to a user
Alias for calling
filter_permissions
with the permissions “r” and “w”