From e0ce7e87fc651746a4aec0c4737563e40e7b07fd Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 12 Dec 2024 14:21:54 +0000 Subject: [PATCH 1/3] Added heading field to coursetranslation --- .../0092_coursetranslation_heading.py | 24 +++++++++++++++++++ breathecode/marketing/models.py | 3 +++ breathecode/marketing/serializers.py | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 breathecode/marketing/migrations/0092_coursetranslation_heading.py diff --git a/breathecode/marketing/migrations/0092_coursetranslation_heading.py b/breathecode/marketing/migrations/0092_coursetranslation_heading.py new file mode 100644 index 000000000..9ae958395 --- /dev/null +++ b/breathecode/marketing/migrations/0092_coursetranslation_heading.py @@ -0,0 +1,24 @@ +# Generated by Django 5.1.2 on 2024-12-12 14:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("marketing", "0091_course_cohorts_order"), + ] + + operations = [ + migrations.AddField( + model_name="coursetranslation", + name="heading", + field=models.CharField( + blank=True, + default=None, + help_text="Heading that will be used in the landing page", + max_length=160, + null=True, + ), + ), + ] diff --git a/breathecode/marketing/models.py b/breathecode/marketing/models.py index 5370aa91a..afea9145f 100644 --- a/breathecode/marketing/models.py +++ b/breathecode/marketing/models.py @@ -867,6 +867,9 @@ class CourseTranslation(models.Model): course = models.ForeignKey(Course, on_delete=models.CASCADE) lang = models.CharField(max_length=5, validators=[validate_language_code]) title = models.CharField(max_length=60) + heading = models.CharField( + max_length=160, help_text="Heading that will be used in the landing page", default=None, null=True, blank=True + ) description = models.TextField(max_length=400) short_description = models.CharField(max_length=120, null=True, default=None, blank=True) video_url = models.URLField( diff --git a/breathecode/marketing/serializers.py b/breathecode/marketing/serializers.py index ff0bafa83..bcbe41d8f 100644 --- a/breathecode/marketing/serializers.py +++ b/breathecode/marketing/serializers.py @@ -2,6 +2,7 @@ import re from datetime import timedelta +from capyc.rest_framework.exceptions import ValidationException from django.db.models.query_utils import Q from django.utils import timezone from rest_framework import serializers @@ -11,7 +12,6 @@ from breathecode.services.activecampaign.client import acp_ids from breathecode.utils import serpy from breathecode.utils.integer_to_base import to_base -from capyc.rest_framework.exceptions import ValidationException from .models import AcademyAlias, ActiveCampaignAcademy, Automation, CourseTranslation, FormEntry, ShortLink, Tag @@ -408,6 +408,7 @@ class GetCourseTranslationSerializer(serpy.Serializer): landing_variables = serpy.Field() landing_url = serpy.Field() video_url = serpy.Field() + heading = serpy.Field() class GetCourseSmallSerializer(serpy.Serializer): From 7e37299901f916b653d17c2fa5aadc3f036041db Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 12 Dec 2024 14:50:58 +0000 Subject: [PATCH 2/3] Changed field to TextField git push --- .../0093_alter_coursetranslation_heading.py | 24 +++++++++++++++++++ breathecode/marketing/models.py | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py diff --git a/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py b/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py new file mode 100644 index 000000000..8afe99a0c --- /dev/null +++ b/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py @@ -0,0 +1,24 @@ +# Generated by Django 5.1.2 on 2024-12-12 14:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("marketing", "0092_coursetranslation_heading"), + ] + + operations = [ + migrations.AlterField( + model_name="coursetranslation", + name="heading", + field=models.TextField( + blank=True, + default=None, + help_text="Heading that will be used in the landing page", + max_length=160, + null=True, + ), + ), + ] diff --git a/breathecode/marketing/models.py b/breathecode/marketing/models.py index afea9145f..e52a29201 100644 --- a/breathecode/marketing/models.py +++ b/breathecode/marketing/models.py @@ -867,7 +867,7 @@ class CourseTranslation(models.Model): course = models.ForeignKey(Course, on_delete=models.CASCADE) lang = models.CharField(max_length=5, validators=[validate_language_code]) title = models.CharField(max_length=60) - heading = models.CharField( + heading = models.TextField( max_length=160, help_text="Heading that will be used in the landing page", default=None, null=True, blank=True ) description = models.TextField(max_length=400) From 95071d35cd4d9ba7762a2f6984c171b9fac96e60 Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 12 Dec 2024 15:03:41 +0000 Subject: [PATCH 3/3] Added greater length --- .../migrations/0093_alter_coursetranslation_heading.py | 2 +- breathecode/marketing/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py b/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py index 8afe99a0c..e39a22fd0 100644 --- a/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py +++ b/breathecode/marketing/migrations/0093_alter_coursetranslation_heading.py @@ -17,7 +17,7 @@ class Migration(migrations.Migration): blank=True, default=None, help_text="Heading that will be used in the landing page", - max_length=160, + max_length=400, null=True, ), ), diff --git a/breathecode/marketing/models.py b/breathecode/marketing/models.py index e52a29201..773ec88ff 100644 --- a/breathecode/marketing/models.py +++ b/breathecode/marketing/models.py @@ -868,7 +868,7 @@ class CourseTranslation(models.Model): lang = models.CharField(max_length=5, validators=[validate_language_code]) title = models.CharField(max_length=60) heading = models.TextField( - max_length=160, help_text="Heading that will be used in the landing page", default=None, null=True, blank=True + max_length=400, help_text="Heading that will be used in the landing page", default=None, null=True, blank=True ) description = models.TextField(max_length=400) short_description = models.CharField(max_length=120, null=True, default=None, blank=True)