Add Payment model

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

View File

@ -0,0 +1,26 @@
# Generated by Django 3.0.11 on 2021-01-18 15:35
from django.db import migrations, models
import django.db.models.deletion
import registration.models
class Migration(migrations.Migration):
dependencies = [
('registration', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Payment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(blank=True, choices=[('', 'No payment'), ('helloasso', 'Hello Asso'), ('scholarship', 'Scholarship'), ('bank_transfer', 'Bank transfer'), ('free', 'The tournament is free')], default='', max_length=16, verbose_name='type')),
('scholarship_file', models.FileField(blank=True, default='', help_text='only if you have a scholarship.', unique=True, upload_to=registration.models.get_scholarship_filename, verbose_name='scholarship file')),
('additional_information', models.TextField(blank=True, default='', help_text='To help us to find your payment.', verbose_name='additional information')),
('valid', models.BooleanField(default=False, null=True, verbose_name='valid')),
('registration', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='registration', to='registration.ParticipantRegistration', verbose_name='registration')),
],
),
]

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,
)

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TFJM\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-18 16:13+0100\n"
"POT-Creation-Date: 2021-01-18 16:33+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -100,7 +100,7 @@ msgid "Changelog of type \"{action}\" for model {model} at {timestamp}"
msgstr "Changelog de type \"{action}\" pour le modèle {model} le {timestamp}"
#: apps/participation/admin.py:19 apps/participation/models.py:297
#: apps/participation/tables.py:44
#: apps/participation/tables.py:44 apps/registration/models.py:336
msgid "valid"
msgstr "valide"
@ -1017,7 +1017,7 @@ msgstr "email confirmé"
msgid "Activate your TFJM² account"
msgstr "Activez votre compte du TFJM²"
#: apps/registration/models.py:99
#: apps/registration/models.py:99 apps/registration/models.py:302
msgid "registration"
msgstr "inscription"
@ -1117,6 +1117,42 @@ msgstr "inscription d'administrateur"
msgid "admin registrations"
msgstr "inscriptions d'administrateur"
#: apps/registration/models.py:306
msgid "type"
msgstr "type"
#: apps/registration/models.py:309
msgid "No payment"
msgstr "Pas de paiement"
#: apps/registration/models.py:311
msgid "Scholarship"
msgstr "Notification de bourse"
#: apps/registration/models.py:312
msgid "Bank transfer"
msgstr "Virement bancaire"
#: apps/registration/models.py:313
msgid "The tournament is free"
msgstr "Le tournoi est gratuit"
#: apps/registration/models.py:320
msgid "scholarship file"
msgstr "Notification de bourse"
#: apps/registration/models.py:321
msgid "only if you have a scholarship."
msgstr "Nécessaire seulement si vous déclarez être boursier."
#: apps/registration/models.py:329
msgid "additional information"
msgstr "informations additionnelles"
#: apps/registration/models.py:330
msgid "To help us to find your payment."
msgstr "Pour nous aider à retrouver votre paiement, si nécessaire."
#: apps/registration/tables.py:17
msgid "last name"
msgstr "nom de famille"