From bcdee8071c1c71b94e26ca3376fa7d953206ba9f Mon Sep 17 00:00:00 2001 From: Orage Pika Date: Sun, 13 Mar 2022 15:49:09 +0100 Subject: [PATCH] fixing errors from check --- ...alter_sitesettings_invite_question_text.py | 23 +++++++++++++++++++ bookwyrm/models/site.py | 3 +-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 bookwyrm/migrations/0146_alter_sitesettings_invite_question_text.py diff --git a/bookwyrm/migrations/0146_alter_sitesettings_invite_question_text.py b/bookwyrm/migrations/0146_alter_sitesettings_invite_question_text.py new file mode 100644 index 00000000..5d0eb93b --- /dev/null +++ b/bookwyrm/migrations/0146_alter_sitesettings_invite_question_text.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.12 on 2022-03-11 15:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0145_auto_20220307_2025"), + ] + + operations = [ + migrations.AlterField( + model_name="sitesettings", + name="invite_question_text", + field=models.CharField( + blank=True, + default="What is your favourite book?", + max_length=255, + null=True, + ), + ), + ] diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index 45fd9f4d..51c7d3a8 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -103,12 +103,11 @@ class SiteSettings(models.Model): return urljoin(STATIC_FULL_URL, default_path) def save(self, *args, **kwargs): - """if require_confirm_email is disabled, make sure no users are pending""" + """if require_confirm_email is disabled, make sure no users are pending, if enabled, make sure invite_question_text is not empty""" if not self.require_confirm_email: 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)