from django.db import models from webservice_running.models import Sportsman, Achievements class Achievement(models.Model): """ Achievement (not to confuse with 'Achievements') stores information about achievement history of users. Соединяющая таблица пользователя и достижения для истории полученных достижений у конкретного пользователя. """ sportsman = models.ForeignKey(Sportsman, on_delete=models.DO_NOTHING, related_name="sportsman_achievement") achievement = models.ForeignKey(Achievements, on_delete=models.DO_NOTHING, related_name="achievement") time_received = models.DateTimeField(auto_now_add=True) class Meta: db_table = "achievement" verbose_name = "достижение пользователя" verbose_name_plural = "достижения пользователя" constraints = [ models.UniqueConstraint(fields=['sportsman', 'achievement'], name='unique_achievement') ]