diff --git a/uniweb/migrations/0135_uniwebformpage_subscribe_to_ecomail.py b/uniweb/migrations/0135_uniwebformpage_subscribe_to_ecomail.py index 513e0255611f0cb5285c6fc14b8db29e7756efa2..422b8b79e64ba51535fb93724fe13e6326e75bf6 100644 --- a/uniweb/migrations/0135_uniwebformpage_subscribe_to_ecomail.py +++ b/uniweb/migrations/0135_uniwebformpage_subscribe_to_ecomail.py @@ -4,15 +4,17 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('uniweb', '0134_uniwebhomepage_fbevents_id'), + ("uniweb", "0134_uniwebhomepage_fbevents_id"), ] operations = [ migrations.AddField( - model_name='uniwebformpage', - name='subscribe_to_ecomail', - field=models.BooleanField(default=False, verbose_name='Automaticky odebĂrat vyplnÄ›nĂ© Ăşdaje do Ecomail NL?'), + model_name="uniwebformpage", + name="subscribe_to_ecomail", + field=models.BooleanField( + default=False, + verbose_name="Automaticky odebĂrat vyplnÄ›nĂ© Ăşdaje do Ecomail NL?", + ), ), ] diff --git a/uniweb/migrations/0136_uniwebformpage_email_field_id_and_more.py b/uniweb/migrations/0136_uniwebformpage_email_field_id_and_more.py index bbc7f50e80ea121c1970ab4c37f0f2630a7a46dd..a3d85aa3c29e5dc4227f3ca8943cb91b90f62ba7 100644 --- a/uniweb/migrations/0136_uniwebformpage_email_field_id_and_more.py +++ b/uniweb/migrations/0136_uniwebformpage_email_field_id_and_more.py @@ -4,20 +4,23 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('uniweb', '0135_uniwebformpage_subscribe_to_ecomail'), + ("uniweb", "0135_uniwebformpage_subscribe_to_ecomail"), ] operations = [ migrations.AddField( - model_name='uniwebformpage', - name='email_field_id', - field=models.CharField(blank=True, null=True, verbose_name='ID email fieldu'), + model_name="uniwebformpage", + name="email_field_id", + field=models.CharField( + blank=True, null=True, verbose_name="ID email fieldu" + ), ), migrations.AddField( - model_name='uniwebformpage', - name='name_and_surname_field_id', - field=models.CharField(blank=True, null=True, verbose_name='ID jmĂ©no & pĹ™ĂjmenĂ fieldu'), + model_name="uniwebformpage", + name="name_and_surname_field_id", + field=models.CharField( + blank=True, null=True, verbose_name="ID jmĂ©no & pĹ™ĂjmenĂ fieldu" + ), ), ] diff --git a/uniweb/migrations/0137_uniwebformpage_submission_button_text.py b/uniweb/migrations/0137_uniwebformpage_submission_button_text.py index 249bcbc3dd1ef540bda622d6a553d0632b074e27..6c0329112a2b1611b40fc70420012d4ac092327e 100644 --- a/uniweb/migrations/0137_uniwebformpage_submission_button_text.py +++ b/uniweb/migrations/0137_uniwebformpage_submission_button_text.py @@ -4,15 +4,16 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('uniweb', '0136_uniwebformpage_email_field_id_and_more'), + ("uniweb", "0136_uniwebformpage_email_field_id_and_more"), ] operations = [ migrations.AddField( - model_name='uniwebformpage', - name='submission_button_text', - field=models.CharField(default='Odeslat', verbose_name='Text tlaÄŤĂtka pro odeslánĂ formuláře'), + model_name="uniwebformpage", + name="submission_button_text", + field=models.CharField( + default="Odeslat", verbose_name="Text tlaÄŤĂtka pro odeslánĂ formuláře" + ), ), ] diff --git a/uniweb/models.py b/uniweb/models.py index b48ce84c4c80c29591caa58264c1296072b3c788..669a18ebeb3a9b1815e017dc25caafba60ee77a4 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -29,7 +29,6 @@ from shared.blocks import ( NewsletterSubscriptionBlock, ) from shared.const import RICH_TEXT_DEFAULT_FEATURES -from shared.utils import subscribe_to_ecomail_newsletter from shared.models import ( CalendarMixin, CustomLogoMixin, @@ -50,6 +49,7 @@ from shared.models import ( SocialMixin, SubpageMixin, ) +from shared.utils import subscribe_to_ecomail_newsletter from shared_legacy.models import FooterMixin as LegacyFooterMixin from shared_legacy.utils import make_promote_panels @@ -503,15 +503,11 @@ class UniwebFormPage( ) name_and_surname_field_id = models.CharField( - verbose_name="ID jmĂ©no & pĹ™ĂjmenĂ fieldu", - blank=True, - null=True + verbose_name="ID jmĂ©no & pĹ™ĂjmenĂ fieldu", blank=True, null=True ) email_field_id = models.CharField( - verbose_name="ID email fieldu", - blank=True, - null=True + verbose_name="ID email fieldu", blank=True, null=True ) submission_button_text = models.CharField( @@ -575,7 +571,8 @@ class UniwebFormPage( cleaned_data = form.cleaned_data if ( - hasattr(self, "root_page") and self.root_page + hasattr(self, "root_page") + and self.root_page and self.subscribe_to_ecomail and self.name_and_surname_field_id in cleaned_data and self.email_field_id in cleaned_data @@ -604,7 +601,7 @@ class UniwebFormPage( self.root_page.ecomail_newsletter_list_tags, self.root_page.ecomail_newsletter_list_source, self.root_page.ecomail_newsletter_list_id, - custom_data + custom_data, ) super().process_form_submission(form)