from django.db import models
from django.contrib.auth.models import User
from django.core.validators import MinValueValidator, MaxValueValidator

class Vote(models.Model):
    class Meta:
        unique_together = ["user", "track"]
    track = models.ForeignKey('Track', on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    points = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(5)])
    skipped = models.BooleanField(default=False)
