from django.db import models from gestion.models import ErnestoUser REP = ( ('oui', 'Oui'), ('non', 'Non'), ) class Prop(models.Model): nom = models.CharField(max_length=100) artiste = models.CharField(blank=True, max_length=100) user = models.ForeignKey(ErnestoUser, on_delete=models.CASCADE, verbose_name="Proposé par") 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: verbose_name = "Proposition" class Reponses(models.Model): 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)