Users app models

class UserApp(*args, **kwargs)

Bases: AbstractUser

User model.

updated_at

Date the user data was updated (DateTimeField).

get_absolute_url() str

Return the url of an instance.

__str__() str

Provide the informal string representation of an object.

class Mentorship(*args, **kwargs)

Bases: Model

Class representing the mentor-student relationship.

A mentor - is a user who can assign exercises to a student and view their solutions. The mentor determines the method of encouraging the student for completing the exercise and provides a reward for successfully solving the task. The mentor can carry out operations to write off the student’s points when encouraging.

mentor

The mentor user (UserApp).

student

The student user (UserApp).

class MentorshipRequest(*args, **kwargs)

Bases: Model

Request from a student to a mentor for mentorship.

Stores the request until it is accepted or rejected.

from_user

The student user (UserApp).

to_user

The mentor user (UserApp).

class Points(*args, **kwargs)

Bases: Model

User points model.

For the correct execution of the exercise, the user receives points. This model stores the history of the user’s points, their receipt, write-off and the balance of points at the current moment.

user

User owner of points (UserApp).

task

The task for which points were awarded (MathematicsAnalytic).

award

Amount of points awarded (int).

write_off

Amount of points written off (int).

balance

Current balance of points (int).

mentorship

Mentorship by virtue of which points are written off (Mentorship).

created_at

Date and time of creation of the record in the table (DateTimeField).

clean() None

Validate the condition of adding entry.

In one entry you can fill only one of the two fields, either award or write_off.

Raises

ValidationError

Raised if both fields award and write_off are added or if both fields award and write_off is null.