Skip to content

Commit

Permalink
feat: add term and conditions field
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Faraz Maqsood committed Oct 23, 2023
1 parent 3737376 commit 10579af
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/djangoapps/student/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def do_create_account(form, custom_form=None):
profile_fields = [
"name", "level_of_education", "gender", "mailing_address", "city", "country", "goals",
"year_of_birth", "national_id", "phone_number", "date_of_birth", "region", "address_line",
"english_language_level", "employment_status", "work_experience_level", "job_title",
"english_language_level", "employment_status", "work_experience_level", "job_title", "terms_and_conditions"
]
profile = UserProfile(
user=user,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.21 on 2023-10-23 06:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('student', '0046_alter_userprofile_english_language_level'),
]

operations = [
migrations.AddField(
model_name='userprofile',
name='terms_and_conditions',
field=models.BooleanField(default=True),
),
]
1 change: 1 addition & 0 deletions common/djangoapps/student/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ class Meta:
employment_status = models.CharField(blank=True, null=True, max_length=3, choices=EMPLOYMENT_STATUS_CHOICES)
work_experience_level = models.CharField(blank=True, null=True, max_length=3, choices=WORK_EXPERIENCE_LEVEL_CHOICES)
job_title = models.CharField(blank=True, null=True, max_length=63)
terms_and_conditions = models.BooleanField(default=True)


@property
Expand Down
2 changes: 2 additions & 0 deletions openedx/core/djangoapps/user_authn/views/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def create_account_with_params(request, params): # pylint: disable=too-many-sta
extra_fields["employment_status"] = "required"
extra_fields["work_experience_level"] = "required"
extra_fields["job_title"] = "required"
extra_fields["terms_and_conditions"] = "required"

if is_registration_api_v1(request):
if 'confirm_email' in extra_fields:
Expand Down Expand Up @@ -590,6 +591,7 @@ def post(self, request):
)

data = request.POST.copy()
data["terms_and_conditions"] = True if data.get("terms_and_conditions")=="true" else False
self._handle_terms_of_service(data)

try:
Expand Down

0 comments on commit 10579af

Please sign in to comment.