tombola-bde-2020/apps/tbde/models.py

46 lines
947 B
Python
Raw Normal View History

2020-02-29 06:20:47 +00:00
# Copyright (C) 2020 by BDE ENS Paris-Saclay
from django.db import models
from django.utils.translation import gettext_lazy as _
class Ticket(models.Model):
number = models.PositiveIntegerField(
verbose_name=_("number")
)
note = models.CharField(
max_length=255,
verbose_name=_("note")
)
2020-02-29 06:26:47 +00:00
def __str__(self):
return "" + str(self.number) + " : " + str(self.note)
2020-02-29 06:20:47 +00:00
class Reward(models.Model):
order = models.PositiveIntegerField(
verbose_name=_("order"),
)
name = models.CharField(
max_length=255,
verbose_name=_("name"),
)
image = models.ImageField(
verbose_name=_("image"),
)
rewarded_by = models.ForeignKey(
Ticket,
on_delete=models.PROTECT,
2020-02-29 06:26:47 +00:00
null=True,
blank=True,
verbose_name=_("rewarded by"),
2020-02-29 06:20:47 +00:00
)
2020-02-29 06:26:47 +00:00
def __str__(self):
return str(self.order) + " - " + str(self.name)