1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-03 17:22:51 +02:00

Add Payment model

This commit is contained in:
Yohann D'ANELLO
2021-01-18 16:35:37 +01:00
parent e0f230b8c7
commit 364025b195
3 changed files with 114 additions and 3 deletions

View File

@ -288,3 +288,52 @@ class AdminRegistration(VolunteerRegistration):
class Meta:
verbose_name = _("admin registration")
verbose_name_plural = _("admin registrations")
def get_scholarship_filename(instance, filename):
return f"authorization/scholarship/scholarship_{instance.registration.pk}"
class Payment(models.Model):
registration = models.OneToOneField(
ParticipantRegistration,
on_delete=models.CASCADE,
related_name="registration",
verbose_name=_("registration"),
)
type = models.CharField(
verbose_name=_("type"),
max_length=16,
choices=[
('', _("No payment")),
('helloasso', "Hello Asso"),
('scholarship', _("Scholarship")),
('bank_transfer', _("Bank transfer")),
('free', _("The tournament is free")),
],
blank=True,
default="",
)
scholarship_file = models.FileField(
verbose_name=_("scholarship file"),
help_text=_("only if you have a scholarship."),
upload_to=get_scholarship_filename,
unique=True,
blank=True,
default="",
)
additional_information = models.TextField(
verbose_name=_("additional information"),
help_text=_("To help us to find your payment."),
blank=True,
default="",
)
valid = models.BooleanField(
verbose_name=_("valid"),
null=True,
default=False,
)