Source code for oioioi.problemsharing.models
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import gettext_lazy as _
from oioioi.base.utils.deps import check_django_app_dependencies
check_django_app_dependencies(__name__, ['oioioi.teachers'])
[docs]class Friendship(models.Model):
"""Represents a friendship between task creators
Friends can access user uploaded problems. Friendship is one-sided.
"""
# "creator" created the friendship (want's their problems to be shared)
[docs] creator = models.ForeignKey(
User,
on_delete=models.CASCADE,
verbose_name=_("creator"),
related_name='friendships_created',
)
# "receiver" gets access to problems of "creator"
[docs] receiver = models.ForeignKey(
User,
on_delete=models.CASCADE,
verbose_name=_("receiver"),
related_name='friendships_received',
)