You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
from django.db import models
|
|
from django.utils import timezone
|
|
from users.models import User, Team
|
|
from specializations.models import Specialization
|
|
|
|
|
|
class HistoryRating(models.Model):
|
|
user = models.ForeignKey(User, related_name='history_ratings', null=True, blank=True)
|
|
team = models.ForeignKey(Team, related_name='history_ratings', null=True, blank=True)
|
|
rating = models.IntegerField(default=0)
|
|
created = models.DateTimeField(default=timezone.now)
|
|
description = models.TextField(blank=True)
|
|
|
|
def __str__(self):
|
|
return '{0}'.format(self.rating)
|
|
|
|
class Meta:
|
|
verbose_name = 'История рейтинга'
|
|
verbose_name_plural = 'Истории рейтинга'
|
|
|
|
|
|
class SpecializationRating(models.Model):
|
|
user = models.ForeignKey(User, related_name='specialization_rating', null=True, blank=True)
|
|
team = models.ForeignKey(Team, related_name='specialization_rating', null=True, blank=True)
|
|
specialization = models.ForeignKey(Specialization, related_name='specialization_rating') # TODO: Pluralize related name
|
|
position = models.PositiveIntegerField(default=0)
|
|
|
|
def __str__(self):
|
|
return '{0}'.format(self.pk)
|
|
|
|
class Meta:
|
|
verbose_name = 'Рейтинг специализаций'
|
|
verbose_name_plural = 'Рейтинги специализаций'
|
|
|