From 3a43d4344b20af100649c27e87d9733f8cfe6ff5 Mon Sep 17 00:00:00 2001 From: Zainab Amir Date: Mon, 23 May 2022 18:30:57 +0500 Subject: [PATCH] feat: add marketing email opt in field Added a new is_marketable field to UserProfile model to store marketing email opt in field on registration form in UserProfile. VAN-970 --- .../0045_add_marketing_email_opt_in_field.py | 18 ++++++++++++++++++ common/djangoapps/student/models.py | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 common/djangoapps/student/migrations/0045_add_marketing_email_opt_in_field.py diff --git a/common/djangoapps/student/migrations/0045_add_marketing_email_opt_in_field.py b/common/djangoapps/student/migrations/0045_add_marketing_email_opt_in_field.py new file mode 100644 index 0000000000..987c84bcf1 --- /dev/null +++ b/common/djangoapps/student/migrations/0045_add_marketing_email_opt_in_field.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.13 on 2022-05-23 13:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('student', '0044_courseenrollmentcelebration_celebrate_weekly_goal'), + ] + + operations = [ + migrations.AddField( + model_name='userprofile', + name='is_marketable', + field=models.BooleanField(default=False, help_text='If selected, user will receive edX marketing emails. The marketing email opt-in checkbox on registration form maps to this field.'), + ), + ] diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 5ef8ea06b4..a3060e1e63 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -612,6 +612,13 @@ class UserProfile(models.Model): profile_image_uploaded_at = models.DateTimeField(null=True, blank=True) phone_regex = RegexValidator(regex=r'^\+?1?\d*$', message="Phone number can only contain numbers.") phone_number = models.CharField(validators=[phone_regex], blank=True, null=True, max_length=50) + is_marketable = models.BooleanField( + default=False, + help_text=_( + "If selected, user will receive edX marketing emails. The marketing email opt-in checkbox on registration " + "form maps to this field." + ), + ) @property def has_profile_image(self):