2015-07-22 22:08:59 +02:00
|
|
|
from django.db import models
|
|
|
|
from gestion.models import ErnestoUser
|
|
|
|
|
|
|
|
REP = (
|
|
|
|
('oui', 'Oui'),
|
|
|
|
('non', 'Non'),
|
|
|
|
)
|
|
|
|
|
2016-07-14 01:58:52 +02:00
|
|
|
|
2015-07-22 22:08:59 +02:00
|
|
|
class Prop(models.Model):
|
2016-07-14 01:58:52 +02:00
|
|
|
nom = models.CharField(max_length=100)
|
|
|
|
artiste = models.CharField(blank=True, max_length=100)
|
2018-01-04 23:43:10 +01:00
|
|
|
user = models.ForeignKey(ErnestoUser, on_delete=models.CASCADE, verbose_name="Proposé par")
|
2015-07-22 22:08:59 +02:00
|
|
|
lien = models.URLField(blank=True)
|
|
|
|
nboui = models.IntegerField(default=0, verbose_name="oui")
|
|
|
|
nbnon = models.IntegerField(default=0, verbose_name="non")
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.nom
|
|
|
|
|
|
|
|
class Meta:
|
2016-07-14 01:58:52 +02:00
|
|
|
verbose_name = "Proposition"
|
|
|
|
|
|
|
|
|
2015-07-22 22:08:59 +02:00
|
|
|
class Reponses(models.Model):
|
2018-01-04 23:43:10 +01:00
|
|
|
prop = models.ForeignKey(Prop, on_delete=models.CASCADE)
|
|
|
|
part = models.ForeignKey(ErnestoUser, on_delete=models.CASCADE)
|
|
|
|
reponse = models.CharField("Réponse", max_length=20, blank=True, choices=REP)
|