rm cofprofile.num, add PEI / GRATIS

This commit is contained in:
Martin Pépin 2017-10-26 14:04:15 +02:00
parent 704731addd
commit 5ab090fa72
4 changed files with 36 additions and 26 deletions

View file

@ -165,14 +165,10 @@ class RegistrationPassUserForm(RegistrationUserForm):
class RegistrationCofProfileForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(RegistrationCofProfileForm, self).__init__(*args, **kwargs)
self.fields['num'].widget.attrs['readonly'] = True
class Meta:
model = CofProfile
fields = [
"num", "type_cotiz",
"type_cotiz",
"mailing", "mailing_bda", "mailing_bda_revente",
]

View file

@ -16,19 +16,22 @@ def get_cof_assoc():
return Association.objects.get(name='COF')
TYPE_COTIZ_CHOICES = (
('etudiant', _("Normalien étudiant")),
('normalien', _("Normalien élève")),
('exterieur', _("Extérieur")),
)
class CofProfile(models.Model):
COTIZ_ETUDIANT = "etudiant"
COTIZ_NORMALIEN = "normalien"
COTIZ_EXTE = "exterieur"
COTIZ_GRATIS = "gratis"
TYPE_COTIZ_CHOICES = (
(COTIZ_ETUDIANT, _("Normalien étudiant")),
(COTIZ_NORMALIEN, _("Normalien élève")),
(COTIZ_EXTE, _("Extérieur")),
(COTIZ_GRATIS, _("Gratuit")),
)
profile = models.OneToOneField(Profile,
on_delete=models.CASCADE,
related_name="cof")
num = models.IntegerField("Numéro d'adhérent", blank=True, default=0)
type_cotiz = models.CharField(_("Type de cotisation"),
default="normalien",
choices=TYPE_COTIZ_CHOICES,

View file

@ -20,7 +20,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
('login_clipper', models.CharField(verbose_name='login clipper', max_length=8, blank=True)),
('phone', models.CharField(verbose_name='téléphone', max_length=20, blank=True)),
('occupation', models.CharField(choices=[('exterieur', 'Extérieur'), ('1A', '1A'), ('2A', '2A'), ('3A', '3A'), ('4A', '4A'), ('archicube', 'Archicube'), ('doctorant', 'Doctorant'), ('CST', 'CST')], verbose_name='occupation', max_length=9, default='1A')),
('occupation', models.CharField(choices=[('exterieur', 'Extérieur'), ('1A', '1A'), ('2A', '2A'), ('3A', '3A'), ('4A', '4A'), ('archicube', 'Archicube'), ('doctorant', 'Doctorant'), ('CST', 'CST'), ('PEI', 'PEI')], verbose_name='occupation', max_length=9, default='1A')),
('departement', models.CharField(verbose_name='département', max_length=50, blank=True)),
('comments', models.TextField(verbose_name="commentaires visibles par l'utilisateur", blank=True)),
('user', models.OneToOneField(

View file

@ -12,19 +12,30 @@ from cof.petits_cours_models import choices_length
# User management
# ---
OCCUPATION_CHOICES = (
('exterieur', _("Extérieur")),
('1A', _("1A")),
('2A', _("2A")),
('3A', _("3A")),
('4A', _("4A")),
('archicube', _("Archicube")),
('doctorant', _("Doctorant")),
('CST', _("CST")),
)
class Profile(models.Model):
STATUS_EXTE = "exterieur"
STATUS_1A = "1A"
STATUS_2A = "2A"
STATUS_3A = "3A"
STATUS_4A = "4A"
STATUS_ARCHI = "archicube"
STATUS_DOCTORANT = "doctorant"
STATUS_CST = "CST"
STATUS_PEI = "PEI"
OCCUPATION_CHOICES = (
(STATUS_EXTE, _("Extérieur")),
(STATUS_1A, _("1A")),
(STATUS_2A, _("2A")),
(STATUS_3A, _("3A")),
(STATUS_4A, _("4A")),
(STATUS_ARCHI, _("Archicube")),
(STATUS_DOCTORANT, _("Doctorant")),
(STATUS_CST, _("CST")),
(STATUS_PEI, _("PEI")),
)
user = models.OneToOneField(
User,
on_delete=models.CASCADE,