invite_question_text resets to default question when left blank

This commit is contained in:
corentin-feys 2022-03-12 11:13:42 +01:00
parent 7337f378c0
commit 5dbee33185

View file

@ -53,7 +53,7 @@ class SiteSettings(models.Model):
invite_question_text = models.CharField(
max_length=255,
null=not (invite_request_question),
blank=True,
default="What is your favourite book?",
)
# images
@ -110,6 +110,9 @@ class SiteSettings(models.Model):
User.objects.filter(is_active=False, deactivation_reason="pending").update(
is_active=True, deactivation_reason=None
)
"""if invite_request_question is enabled, make sure invite_question_text is not empty"""
if not self.invite_question_text:
self.invite_question_text = "What is your favourite book?"
super().save(*args, **kwargs)