site_tps/vote/models.py

16 lines
466 B
Python
Raw Normal View History

2018-01-14 12:19:11 +00:00
from django.db import models
from django.core import validators
2018-01-22 13:10:37 +00:00
from content.models import Content
from django.contrib.auth.models import Group, User
2018-01-21 00:10:32 +00:00
class Vote(models.Model):
2018-01-22 13:10:37 +00:00
votant = models.ForeignKey(User, on_delete=models.CASCADE)
content = models.ForeignKey(Content, on_delete=models.CASCADE)
vote = models.IntegerField(
2018-01-21 00:10:32 +00:00
validators=[
validators.MaxValueValidator(5),
validators.MinValueValidator(0)
]
)