diff --git a/cms/migrations/0002_links_delete_socialmedialinks.py b/cms/migrations/0002_links_delete_socialmedialinks.py new file mode 100644 index 00000000..19be7a04 --- /dev/null +++ b/cms/migrations/0002_links_delete_socialmedialinks.py @@ -0,0 +1,82 @@ +# Generated by Django 4.2.5 on 2024-01-07 14:06 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("wagtailcore", "0089_log_entry_data_json_null_to_object"), + ("cms", "0001_initial"), + ] + + operations = [ + migrations.CreateModel( + name="Links", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "facebook", + models.URLField(blank=True, help_text="Facebook URL", null=True), + ), + ( + "twitter", + models.URLField(blank=True, help_text="Twitter URL", null=True), + ), + ( + "youtube", + models.URLField( + blank=True, help_text="YouTube Channel URL", null=True + ), + ), + ( + "linkedin", + models.URLField(blank=True, help_text="Linkedin URL", null=True), + ), + ( + "github", + models.URLField(blank=True, help_text="GitHub URL", null=True), + ), + ( + "instagram", + models.URLField(blank=True, help_text="Instagram URL", null=True), + ), + ( + "whatsapp", + models.URLField(blank=True, help_text="Whatapp URL", null=True), + ), + ( + "telegram", + models.URLField(blank=True, help_text="Telegram URL", null=True), + ), + ( + "email", + models.EmailField( + blank=True, help_text="Email Address", max_length=254, null=True + ), + ), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.site", + ), + ), + ], + options={ + "abstract": False, + }, + ), + migrations.DeleteModel( + name="SocialMediaLinks", + ), + ] diff --git a/cms/migrations/0003_legal.py b/cms/migrations/0003_legal.py new file mode 100644 index 00000000..b001c2d9 --- /dev/null +++ b/cms/migrations/0003_legal.py @@ -0,0 +1,69 @@ +# Generated by Django 4.2.5 on 2024-01-07 14:32 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("wagtailcore", "0089_log_entry_data_json_null_to_object"), + ("cms", "0002_links_delete_socialmedialinks"), + ] + + operations = [ + migrations.CreateModel( + name="Legal", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "impress_page", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + ( + "privacy_policy_page", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.site", + ), + ), + ( + "terms_page", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + ], + options={ + "abstract": False, + }, + ), + ] diff --git a/cms/migrations/0004_legal_impress_page_de_legal_impress_page_en_and_more.py b/cms/migrations/0004_legal_impress_page_de_legal_impress_page_en_and_more.py new file mode 100644 index 00000000..6cbda43d --- /dev/null +++ b/cms/migrations/0004_legal_impress_page_de_legal_impress_page_en_and_more.py @@ -0,0 +1,112 @@ +# Generated by Django 4.2.5 on 2024-01-07 14:36 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("cms", "0003_legal"), + ] + + operations = [ + migrations.AddField( + model_name="legal", + name="impress_page_de", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="impress_page_en", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="impress_page_es", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="privacy_policy_page_de", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="privacy_policy_page_en", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="privacy_policy_page_es", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="terms_page_de", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="terms_page_en", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + migrations.AddField( + model_name="legal", + name="terms_page_es", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="cms.textpage", + ), + ), + ] diff --git a/cms/models/__init__.py b/cms/models/__init__.py index 0e2071e4..af072452 100644 --- a/cms/models/__init__.py +++ b/cms/models/__init__.py @@ -10,10 +10,11 @@ from .menus import CustomMainMenuItem from .setttings import Banner from .setttings import Brand -from .setttings import SocialMediaLinks +from .setttings import Links from .snippets import FrequentAskedQuestion from .snippets import Person from .text import TextPage + # Home page # Blog pages # Text page diff --git a/cms/models/djangopages.py b/cms/models/djangopages.py index 170a696e..9cf0eb80 100644 --- a/cms/models/djangopages.py +++ b/cms/models/djangopages.py @@ -17,7 +17,7 @@ class DjangoServedPage(Page): template = "404.html" subpage_types = [] - parent_page_type = ["wagtailcore.Page"] + parent_page_type = ["cms.HomePage"] content_panels = [ FieldPanel("title"), diff --git a/cms/models/flex.py b/cms/models/flex.py index 425cb776..3b0a7ac6 100644 --- a/cms/models/flex.py +++ b/cms/models/flex.py @@ -5,5 +5,7 @@ class FlexPage(Page): template = "cms/flexpage.html" + subpage_types = [] + parent_page_type = ["cms.HomePage"] body = FullStreamBlock() diff --git a/cms/models/setttings.py b/cms/models/setttings.py index 6eb12bd4..94a76ac3 100644 --- a/cms/models/setttings.py +++ b/cms/models/setttings.py @@ -7,13 +7,13 @@ from wagtail.images.models import Image - from ..utils import localized_fieldpanel_list +from .text import TextPage @register_setting(icon="link") -class SocialMediaLinks(BaseSiteSetting): - """Social media settings for our custom website.""" +class Links(BaseSiteSetting): + """Links settings for our custom website.""" facebook = models.URLField(blank=True, null=True, help_text="Facebook URL") twitter = models.URLField(blank=True, null=True, help_text="Twitter URL") @@ -21,6 +21,9 @@ class SocialMediaLinks(BaseSiteSetting): linkedin = models.URLField(blank=True, null=True, help_text="Linkedin URL") github = models.URLField(blank=True, null=True, help_text="GitHub URL") instagram = models.URLField(blank=True, null=True, help_text="Instagram URL") + whatsapp = models.URLField(blank=True, null=True, help_text="Whatapp URL") + telegram = models.URLField(blank=True, null=True, help_text="Telegram URL") + email = models.EmailField(blank=True, null=True, help_text="Email Address") panels = [ MultiFieldPanel( @@ -30,8 +33,11 @@ class SocialMediaLinks(BaseSiteSetting): FieldPanel("youtube"), FieldPanel("linkedin"), FieldPanel("instagram"), + FieldPanel("whatsapp"), + FieldPanel("telegram"), + FieldPanel("email"), ], - heading="Social Media Settings", + heading="Links", ) ] @@ -58,6 +64,37 @@ class Brand(BaseSiteSetting): ] +@register_setting(icon="user") +class Legal(BaseSiteSetting): + privacy_policy_page = models.ForeignKey( + TextPage, + on_delete=models.CASCADE, + blank=True, + null=True, + related_name="+", + ) + terms_page = models.ForeignKey( + TextPage, + on_delete=models.CASCADE, + blank=True, + null=True, + related_name="+", + ) + impress_page = models.ForeignKey( + TextPage, + on_delete=models.CASCADE, + blank=True, + null=True, + related_name="+", + ) + + panels = ( + localized_fieldpanel_list("privacy_policy_page") + + localized_fieldpanel_list("terms_page") + + localized_fieldpanel_list("impress_page") + ) + + @register_setting(icon="pick") class Banner(BaseSiteSetting): linked_page = models.ForeignKey( diff --git a/cms/models/text.py b/cms/models/text.py index 73a59090..e2d42cac 100644 --- a/cms/models/text.py +++ b/cms/models/text.py @@ -9,6 +9,9 @@ class TextPage(Page): template = "cms/textpage.html" + subpage_types = [] + parent_page_type = ["cms.HomePage"] + body = StreamField( TextStreamBlock(features=settings.CMS_RICHTEXT_FEATURES), verbose_name="Home content block", diff --git a/cms/translation.py b/cms/translation.py index 54937325..c051e1b6 100644 --- a/cms/translation.py +++ b/cms/translation.py @@ -1,12 +1,9 @@ from modeltranslation.translator import register from modeltranslation.translator import TranslationOptions -from .models import Banner -from .models import Brand -from .models import CustomFlatMenu -from .models import CustomFlatMenuItem -from .models import CustomMainMenuItem -from .models import FrequentAskedQuestion +from .models.setttings import Banner, Brand, Legal +from .models.menus import CustomFlatMenu, CustomFlatMenuItem, CustomMainMenuItem +from .models.snippets import FrequentAskedQuestion # menus @@ -40,3 +37,9 @@ class BannerTranslationOptions(TranslationOptions): @register(FrequentAskedQuestion) class FrequentAskedQuestionTranslationOptions(TranslationOptions): fields = ("question", "answer") + + +# LEgal +@register(Legal) +class LegalTranslationOptions(TranslationOptions): + fields = ("privacy_policy_page", "terms_page", "impress_page") diff --git a/config/settings.py b/config/settings.py index de72de5c..69f3f9ee 100644 --- a/config/settings.py +++ b/config/settings.py @@ -96,11 +96,10 @@ "crispy_forms", "crispy_tailwind", "debug_toolbar", - "generic_chooser", + # "generic_chooser", "fontawesomefree", "django_minify_html", "django_tweets", - "wagtailsvg", "dbbackup", "djstripe", "geoip2", diff --git a/requirements.in b/requirements.in index b33f777b..2bb0e74c 100644 --- a/requirements.in +++ b/requirements.in @@ -30,7 +30,6 @@ Jinja2 wagtail wagtail-localize wagtailmenus -wagtailsvg fontawesomefree whitenoise[brotli] django-minify-html diff --git a/requirements.txt b/requirements.txt index e320b3aa..6369f99c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -346,7 +346,6 @@ requests==2.31.0 # stripe # tweepy # wagtail - # wagtail-generic-chooser requests-oauthlib==1.3.1 # via # django-allauth @@ -405,14 +404,10 @@ wagtail==5.1.1 # wagtail-localize wagtail-birdsong==1.1.2 # via -r requirements.in -wagtail-generic-chooser==0.5.1 - # via wagtailsvg wagtail-localize==1.5.2 # via -r requirements.in wagtailmenus==3.1.9 # via -r requirements.in -wagtailsvg==0.0.37 - # via -r requirements.in wcwidth==0.2.6 # via prompt-toolkit webencodings==0.5.1 diff --git a/templates/account/signup.html b/templates/account/signup.html index e7302f94..f354c383 100644 --- a/templates/account/signup.html +++ b/templates/account/signup.html @@ -20,6 +20,14 @@
{% endif %} ++ {% blocktrans %}By signing up, you agree to our + Privacy Policy + and + Terms of Service + + {% endblocktrans %} +