|
@@ -6,6 +6,7 @@ from ldapdb.models.fields import CharField, IntegerField, ListField
|
|
|
from django.db.models.signals import post_save, pre_save
|
|
|
from django.dispatch import receiver
|
|
|
from south.modelsinspector import add_ignored_fields
|
|
|
+from datetime import date
|
|
|
|
|
|
class LdapUser(ldapdb.models.Model):
|
|
|
base_dn = "ou=users,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR" #TODO déplacer dans settings.py
|
|
@@ -31,6 +32,7 @@ class Member(models.Model):
|
|
|
MEMBER_TYPE_CHOICES =(('personne_physique','Personne physique'),('personne_morale','Personne morale'))
|
|
|
MEMBER_STATUS_CHOICES = (('adherent','Adhérent'),('non_adherent','Non adhérent'),('demande_adhesion','Demande d\'adhésion'))
|
|
|
|
|
|
+ status = models.CharField(max_length=50, choices=MEMBER_STATUS_CHOICES, default='non_adherent');
|
|
|
type = models.CharField(max_length=20, choices=MEMBER_TYPE_CHOICES, default='personne_physique');
|
|
|
first_name = models.CharField(max_length=200);
|
|
|
last_name = models.CharField(max_length=200);
|
|
@@ -40,11 +42,10 @@ class Member(models.Model):
|
|
|
home_phone_number = models.CharField(max_length=25, blank=True);
|
|
|
mobile_phone_number = models.CharField(max_length=25, blank=True);
|
|
|
address = models.TextField();
|
|
|
- postal_code = models.CharField(max_length=15);
|
|
|
+ postal_code = models.CharField(max_length=15);
|
|
|
city = models.CharField(max_length=200);
|
|
|
country = models.CharField(max_length=200);
|
|
|
- status = models.CharField(max_length=50, choices=MEMBER_STATUS_CHOICES, default='non_adherent');
|
|
|
- entry_date = models.DateField(null=True, blank=True);
|
|
|
+ entry_date = models.DateField(null=False, blank=False, default=date.today);
|
|
|
resign_date = models.DateField(null=True, blank=True);
|
|
|
|
|
|
def __unicode__(self):
|
|
@@ -62,6 +63,11 @@ class CryptoKey(models.Model):
|
|
|
def __unicode__(self):
|
|
|
return self.member.__str__();
|
|
|
|
|
|
+class MembershipFee(models.Model):
|
|
|
+ member = models.ForeignKey('Member');
|
|
|
+ amount = models.IntegerField(null=False, default='20');
|
|
|
+ date = models.DateField(null=False, blank=False, default=date.today);
|
|
|
+
|
|
|
|
|
|
#~ Lors de la sauvegarde d'un membre, cette fonction est exécutée pour mettre à jour les données dans le LDAP
|
|
|
@receiver(post_save, sender=Member)
|