forked from DGNum/gestioCOF
Major update
This commit is contained in:
parent
8e1bf7b705
commit
2479b0a24d
33 changed files with 1194 additions and 110 deletions
|
@ -26,9 +26,11 @@ def choices_length (choices):
|
|||
return reduce (lambda m, choice: max (m, len (choice[0])), choices, 0)
|
||||
|
||||
class CofProfile(models.Model):
|
||||
user = models.OneToOneField(User)
|
||||
login_clipper = models.CharField("Login clipper", max_length = 8)
|
||||
user = models.OneToOneField(User, related_name = "profile")
|
||||
login_clipper = models.CharField("Login clipper", max_length = 8, blank = True)
|
||||
is_cof = models.BooleanField("Membre du COF", default = False)
|
||||
num = models.IntegerField ("Numéro d'adhérent", blank = True, default = 0),
|
||||
phone = models.CharField("Téléphone", max_length = 20, blank = True)
|
||||
occupation = models.CharField (_(u"Occupation"),
|
||||
default = "1A",
|
||||
choices = OCCUPATION_CHOICES,
|
||||
|
@ -37,20 +39,27 @@ class CofProfile(models.Model):
|
|||
default = "normalien",
|
||||
choices = TYPE_COTIZ_CHOICES,
|
||||
max_length = choices_length (TYPE_COTIZ_CHOICES))
|
||||
mailing_cof = models.BooleanField("Recevoir les mails COF", default = True)
|
||||
mailing_bda_revente = models.BooleanField("Recevoir les mails de revente de places BDA", default = True)
|
||||
mailing_cof = models.BooleanField("Recevoir les mails COF", default = False)
|
||||
mailing_bda_revente = models.BooleanField("Recevoir les mails de revente de places BDA", default = False)
|
||||
is_buro = models.BooleanField("Membre du Burô", default = False)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Profil COF"
|
||||
verbose_name_plural = "Profils COF"
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.user.username)
|
||||
|
||||
def create_user_profile(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
CofProfile.objects.create(user = instance)
|
||||
CofProfile.objects.get_or_create(user = instance)
|
||||
post_save.connect(create_user_profile, sender = User)
|
||||
|
||||
class Event(models.Model):
|
||||
title = models.CharField("Titre", max_length = 200)
|
||||
location = models.CharField("Lieu", max_length = 200)
|
||||
start_date = models.DateField("Date de début", blank = True)
|
||||
end_date = models.DateField("Date de fin", blank = True)
|
||||
start_date = models.DateField("Date de début", blank = True, null = True)
|
||||
end_date = models.DateField("Date de fin", blank = True, null = True)
|
||||
description = models.TextField("Description", blank = True)
|
||||
registration_open = models.BooleanField("Inscriptions ouvertes", default = True)
|
||||
|
||||
|
@ -61,8 +70,9 @@ class Event(models.Model):
|
|||
return unicode(self.title)
|
||||
|
||||
class EventOption(models.Model):
|
||||
event = models.ForeignKey(Event)
|
||||
event = models.ForeignKey(Event, related_name = "options")
|
||||
name = models.CharField("Option", max_length = 200)
|
||||
multi_choices = models.BooleanField("Choix multiples", default = False)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Option"
|
||||
|
@ -71,7 +81,7 @@ class EventOption(models.Model):
|
|||
return unicode(self.name)
|
||||
|
||||
class EventOptionChoice(models.Model):
|
||||
event_option = models.ForeignKey(EventOption)
|
||||
event_option = models.ForeignKey(EventOption, related_name = "choices")
|
||||
value = models.CharField("Valeur", max_length = 200)
|
||||
|
||||
class Meta:
|
||||
|
@ -88,6 +98,7 @@ class EventRegistration(models.Model):
|
|||
|
||||
class Meta:
|
||||
verbose_name = "Inscription"
|
||||
unique_together = ("user", "event")
|
||||
|
||||
class Survey(models.Model):
|
||||
title = models.CharField("Titre", max_length = 200)
|
||||
|
@ -124,7 +135,8 @@ class SurveyQuestionAnswer(models.Model):
|
|||
class SurveyAnswer(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
survey = models.ForeignKey(Survey)
|
||||
answers = models.ManyToManyField(SurveyQuestionAnswer)
|
||||
answers = models.ManyToManyField(SurveyQuestionAnswer, related_name = "selected_by")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Réponses"
|
||||
unique_together = ("user", "survey")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue