diff --git a/config/settings.py b/config/settings.py index 67001dd6..cac01893 100644 --- a/config/settings.py +++ b/config/settings.py @@ -230,6 +230,8 @@ USE_I18N = True +USE_L10N = True + WAGTAIL_I18N_ENABLED = True @@ -441,6 +443,13 @@ ROSETTA_ENABLE_TRANSLATION_SUGGESTIONS = True ROSETTA_WSGI_AUTO_RELOAD = True +# wagtail-localize + +WAGTAILLOCALIZE_MACHINE_TRANSLATOR = { + "CLASS": "wagtail_localize.machine_translators.deepl.DeepLTranslator", + "OPTIONS": {"AUTH_KEY": DEEPL_AUTH_KEY}, +} + # shell-plus diff --git a/core/migrations/0019_freeplan_profile_manual_premiumplan_profile_manual_and_more.py b/core/migrations/0019_freeplan_profile_manual_premiumplan_profile_manual_and_more.py new file mode 100644 index 00000000..a469a1d1 --- /dev/null +++ b/core/migrations/0019_freeplan_profile_manual_premiumplan_profile_manual_and_more.py @@ -0,0 +1,30 @@ +# Generated by Django 4.2.5 on 2023-12-29 12:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("core", "0018_alter_achievement_title"), + ] + + operations = [ + migrations.AddField( + model_name="freeplan", + name="profile_manual", + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name="premiumplan", + name="profile_manual", + field=models.BooleanField(default=False), + ), + migrations.AddConstraint( + model_name="premiumplan", + constraint=models.UniqueConstraint( + condition=models.Q(("profile_manual", True)), + fields=("profile_manual",), + name="unique_plan_with_manual_profile", + ), + ), + ] diff --git a/core/models/plans.py b/core/models/plans.py index 4cc7eef0..1f1b8ff2 100644 --- a/core/models/plans.py +++ b/core/models/plans.py @@ -1,6 +1,6 @@ import auto_prefetch from django.db import models -from django.db.models import UniqueConstraint +from django.db.models import UniqueConstraint, Q from django.urls import reverse from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ @@ -13,6 +13,7 @@ class AbractPlan(auto_prefetch.Model): profiles = models.PositiveSmallIntegerField(default=1) includes_support = models.BooleanField(default=False) profile_translation = models.BooleanField(default=False) + profile_manual = models.BooleanField(default=False) premium_templates = models.BooleanField(default=False) class Meta(auto_prefetch.Model.Meta): @@ -44,7 +45,17 @@ def __str__(self): class Meta(auto_prefetch.Model.Meta): ordering = ("months", "price") - constraints = (UniqueConstraint(fields=["months"], name="unique_months_field"),) + constraints = ( + UniqueConstraint( + fields=["months"], + name="unique_months_field", + ), + UniqueConstraint( + fields=("profile_manual",), + condition=Q(profile_manual=True), + name="unique_plan_with_manual_profile", + ), + ) @cached_property def detail_url(self): diff --git a/core/signals.py b/core/signals.py index e968ba70..10af8219 100644 --- a/core/signals.py +++ b/core/signals.py @@ -22,4 +22,22 @@ def send_welcome_email(sender, instance, created, **kwargs): """ ) m = EmailMessage(subject, body, settings.DEFAULT_FROM_EMAIL, [instance.user.email]) - m.send(fail_silently=False) + m.send(fail_silently=True) + + ## check if user has ordered a plan with manual profile creation + if instance.plan.profile_manual: + subject_m = "Nice CV | " + _("Send us your actual CV") + body_m = _( + """Hi again, + +Great choice! You have ordered our special plan which includes writing a CV for you. + +In order for us to proceed, we need your actual CV. So please send it to us and we will start working on it as soon as possible. + +I look forward to your feedback! +""" + ) + m_m = EmailMessage( + subject_m, body_m, settings.DEFAULT_FROM_EMAIL, [instance.user.email] + ) + m_m.send(fail_silently=True)