Ajout des modèles votants et votes dans vote
This commit is contained in:
parent
dd78cca6bb
commit
246b1b27a8
1 changed files with 21 additions and 1 deletions
|
@ -1,3 +1,23 @@
|
|||
from django.db import models
|
||||
from django.core import validators
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Votants(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
firstname = models.CharField(max_length=100)
|
||||
email = models.EmailField(max_length=200)
|
||||
ecole = models.ForeignKey(Ecole, on_delete=models.CASCADE)
|
||||
password = models.CharField(max_length=100)
|
||||
|
||||
def __str__(self):
|
||||
return self.firstname + " " + self.name
|
||||
|
||||
class Votes(models.Model):
|
||||
votant = models.ForeignKey(Votants, on_delete = models.CASCADE)
|
||||
video = models.ForeignKey(Videos, on_delete = models.CASCADE)
|
||||
categorie = models.ForeignKey(Categories, on_delete = models.CASCADE)
|
||||
vote = models.IntegerField(
|
||||
min_value = 0,
|
||||
max_value = 5,
|
||||
validators = [validators.MaxValueValidator(5),validators.MinValueValidator(0)]
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue