from django.db import models from webservice_running.models import Sportsman class SavedSportsman(models.Model): """ Соединяющая таблица двух пользователей для реализации функционала сохранения пользователя в список сохранённых """ sportsman = models.ForeignKey(Sportsman, on_delete=models.DO_NOTHING, related_name="sportsman_savedsportsman") sportsman_saved = models.ForeignKey(Sportsman, on_delete=models.DO_NOTHING, related_name="sportsman_saved") class Meta: db_table = "saved_sportsman" verbose_name = "сохранённый ползователь" verbose_name_plural = "сохранённые пользователи" constraints = [ models.UniqueConstraint(fields=['sportsman', 'sportsman_saved'], name='unique_saved_sportsman') ]