Skip to content

Commit

Permalink
manual profile
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiboutas committed Dec 29, 2023
1 parent fdc620b commit f5c344c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
9 changes: 9 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@

USE_I18N = True

USE_L10N = True


WAGTAIL_I18N_ENABLED = True

Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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",
),
),
]
15 changes: 13 additions & 2 deletions core/models/plans.py
Original file line number Diff line number Diff line change
@@ -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 _
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
20 changes: 19 additions & 1 deletion core/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit f5c344c

Please sign in to comment.