Fix #134.
Fill bds.models with the required fields; add migration scripts, and a stupid unittests that checks the model really works. Note: old fields will migrate to datetime.now().
This commit is contained in:
parent
f0c3def935
commit
a2b8dee022
3 changed files with 71 additions and 7 deletions
|
@ -1,9 +1,56 @@
|
|||
from django.db import models
|
||||
import os.path
|
||||
from datetime import datetime
|
||||
|
||||
from django.db import models
|
||||
|
||||
from gestion.models import Profile
|
||||
|
||||
class BdsProfile(Profile):
|
||||
profile = models.OneToOneField(Profile, on_delete=models.CASCADE)
|
||||
class BdsProfile(models.Model):
|
||||
profile = models.OneToOneField(Profile,
|
||||
related_name='bds',
|
||||
on_delete=models.CASCADE)
|
||||
|
||||
# mailing = models.BooleanField("Recevoir les mails BDS", default=False)
|
||||
def issue_file_name(sportif, filename):
|
||||
fn, extension = os.path.splitext(filename)
|
||||
year = str(datetime.now().year)
|
||||
return "certifs/" + sportif.__str__() + '-' + year + extension
|
||||
|
||||
COTIZ_DURATION_CHOICES = (
|
||||
('ANN', 'Année'),
|
||||
('SE1', 'Premier semestre'),
|
||||
('SE2', 'Deuxième semestre'),
|
||||
)
|
||||
|
||||
PAYMENT_METHOD_CHOICES = (
|
||||
('CASH', 'Liquide'),
|
||||
('BANK', 'Transfer bancaire'),
|
||||
('CHEQUE', 'Cheque'),
|
||||
('OTHER', 'Autre'),
|
||||
)
|
||||
|
||||
ASPSL_number = models.CharField("Numéro AS PSL",
|
||||
max_length=50,
|
||||
blank=True,
|
||||
null=True)
|
||||
FFSU_number = models.CharField("Numéro FFSU",
|
||||
max_length=50,
|
||||
blank=True,
|
||||
null=True)
|
||||
|
||||
have_certificate = models.BooleanField("Certificat médical",
|
||||
default=False)
|
||||
certificate_file = models.FileField("Fichier de certificat médical",
|
||||
upload_to=issue_file_name,
|
||||
blank=True)
|
||||
|
||||
cotisation_period = models.CharField("Inscription",
|
||||
default="ANN",
|
||||
choices=COTIZ_DURATION_CHOICES,
|
||||
max_length=3)
|
||||
registration_date = models.DateField(auto_now_add=True,
|
||||
verbose_name="Date d'inscription")
|
||||
|
||||
payment_method = models.CharField('Methode de paiement',
|
||||
default='CASH',
|
||||
choices=PAYMENT_METHOD_CHOICES,
|
||||
max_length=6)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue