Commit 2587edbe authored by fred's avatar fred
Browse files

misc: handle existing subscribers by resetting existing data

parent 51b4b1bb
......@@ -28,16 +28,23 @@ from ckeditor.fields import RichTextField
class Subscriber(models.Model) :
email = models.EmailField(unique = True) # TODO : informer si déjà inscrit ? Que faire dans ce cas.
email = models.EmailField(unique=True)
inscription_date = models.DateField(auto_now_add=True)
is_validated = models.NullBooleanField() # Au click sur le lien de confirmation. Null si erreur à l'envoi au souscripteur.
is_registered = models.NullBooleanField() # À l'inscription après la confirmation Null si erreur à l'envoi à mailman.
password = models.CharField(max_length=100) # sha1
is_validated = models.NullBooleanField()
is_registered = models.NullBooleanField()
password = models.CharField(max_length=100)
def __unicode__(self) :
def save(self, *args, **kwargs):
existing_subscriber = self.objects.filter(
if existing_subscriber and !=
# reset existing subscriber
existing_subscriber.is_validated = None
existing_subscriber.is_registered = None
super(Subscriber, self).save(*args, **kwargs)
if self.is_validated is None:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment