Ordre des participants + unicité
This commit is contained in:
parent
22cf0d403e
commit
84dab59c72
1 changed files with 9 additions and 1 deletions
|
@ -198,7 +198,9 @@ class Participant(models.Model):
|
||||||
attributions = models.ManyToManyField(
|
attributions = models.ManyToManyField(
|
||||||
Spectacle, through="Attribution", related_name="attributed_to"
|
Spectacle, through="Attribution", related_name="attributed_to"
|
||||||
)
|
)
|
||||||
tirage = models.ForeignKey(Tirage, on_delete=models.CASCADE)
|
tirage = models.ForeignKey(
|
||||||
|
Tirage, on_delete=models.CASCADE, limit_choices_to={"archived": False}
|
||||||
|
)
|
||||||
accepte_charte = models.BooleanField("A accepté la charte BdA", default=False)
|
accepte_charte = models.BooleanField("A accepté la charte BdA", default=False)
|
||||||
choicesrevente = models.ManyToManyField(
|
choicesrevente = models.ManyToManyField(
|
||||||
Spectacle, related_name="subscribed", blank=True
|
Spectacle, related_name="subscribed", blank=True
|
||||||
|
@ -209,6 +211,12 @@ class Participant(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s - %s" % (self.user, self.tirage.title)
|
return "%s - %s" % (self.user, self.tirage.title)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ("-tirage", "user__last_name", "user__first_name")
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(fields=("tirage", "user"), name="unique_tirage"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
DOUBLE_CHOICES = (
|
DOUBLE_CHOICES = (
|
||||||
("1", "1 place"),
|
("1", "1 place"),
|
||||||
|
|
Loading…
Reference in a new issue