Skip to content

Commit

Permalink
feat!: code progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Faraz Maqsood authored and Muhammad Faraz Maqsood committed Oct 5, 2023
1 parent ccdbf16 commit e8190cf
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 57 deletions.
3 changes: 1 addition & 2 deletions common/djangoapps/student/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +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",
"type_of_degree", "english_language_level", "employment_status", "work_experience_level",
"job_title",
"english_language_level", "employment_status", "work_experience_level", "job_title",
]
profile = UserProfile(
user=user,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.20 on 2023-10-03 11:40
# Generated by Django 3.2.20 on 2023-10-05 09:06

from django.db import migrations, models

Expand Down Expand Up @@ -45,14 +45,14 @@ class Migration(migrations.Migration):
name='region',
field=models.CharField(blank=True, choices=[('RD', 'Riyadh'), ('ER', 'Eastern'), ('AI', 'Asir'), ('JA', 'Jazan'), ('MN', 'Medina'), ('AS', 'Al-Qassim'), ('TU', 'Tabuk'), ('HI', "Ha'il"), ('NA', 'Najran'), ('AW', 'Al-Jawf'), ('AA', 'Al-Bahah'), ('NB', 'Northern Borders')], max_length=3, null=True),
),
migrations.AddField(
model_name='userprofile',
name='type_of_degree',
field=models.CharField(blank=True, choices=[('MS', 'Middle School'), ('HS', 'High School'), ('DM', 'Diploma'), ('BS', 'Bachelor'), ('MR', 'Master'), ('PH', 'Ph.D.')], max_length=3, null=True),
),
migrations.AddField(
model_name='userprofile',
name='work_experience_level',
field=models.CharField(blank=True, choices=[('JL', 'Junior level (0-2) years'), ('ML', 'Middle level (3-4) years'), ('SL', 'Senior level (5-10) years'), ('EL', 'Expert (+ 10 years)')], max_length=3, null=True),
),
migrations.AlterField(
model_name='userprofile',
name='level_of_education',
field=models.CharField(blank=True, choices=[('MS', 'Middle School'), ('HS', 'High School'), ('DM', 'Diploma'), ('BS', 'Bachelor'), ('MR', 'Master'), ('PH', 'Ph.D.')], db_index=True, max_length=3, null=True),
),
]
28 changes: 7 additions & 21 deletions common/djangoapps/student/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,20 +468,15 @@ class Meta:
# ('p_se', 'Doctorate in science or engineering'),
# ('p_oth', 'Doctorate in another field'),
LEVEL_OF_EDUCATION_CHOICES = (
('p', gettext_noop('Doctorate')),
('m', gettext_noop("Master's or professional degree")),
('b', gettext_noop("Bachelor's degree")),
('a', gettext_noop("Associate degree")),
('hs', gettext_noop("Secondary/high school")),
('jhs', gettext_noop("Junior secondary/junior high/middle school")),
('el', gettext_noop("Elementary/primary school")),
# Translators: 'None' refers to the student's level of education
('none', gettext_noop("No formal education")),
# Translators: 'Other' refers to the student's level of education
('other', gettext_noop("Other education"))
('MS', 'Middle School'),
('HS', 'High School'),
('DM', 'Diploma'),
('BS', 'Bachelor'),
('MR', 'Master'),
('PH', 'Ph.D.'),
)
level_of_education = models.CharField(
blank=True, null=True, max_length=6, db_index=True,
blank=True, null=True, max_length=3, db_index=True,
choices=LEVEL_OF_EDUCATION_CHOICES
)
mailing_address = models.TextField(blank=True, null=True)
Expand Down Expand Up @@ -566,14 +561,6 @@ class Meta:
('AA', 'Al-Bahah'),
('NB', 'Northern Borders'),
)
TYPE_OF_DEGREE_CHOICES = (
('MS', 'Middle School'),
('HS', 'High School'),
('DM', 'Diploma'),
('BS', 'Bachelor'),
('MR', 'Master'),
('PH', 'Ph.D.'),
)
EMPLOYMENT_STATUS_CHOICES = (
('PU', 'Public industry'),
('PR', 'Private industry'),
Expand Down Expand Up @@ -602,7 +589,6 @@ class Meta:
date_of_birth = models.DateField(default=None, null=True, blank=True)
region = models.CharField(blank=True, null=True, max_length=3, choices=REGION_CHOICES)
address_line = models.TextField(blank=True, null=True)
type_of_degree = models.CharField(blank=True, null=True, max_length=3, choices=TYPE_OF_DEGREE_CHOICES)
english_language_level = models.CharField(blank=True, null=True, max_length=2, choices=ENGLISH_LANGUAGE_LEVEL_CHOICES)
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)
Expand Down
1 change: 0 additions & 1 deletion openedx/core/djangoapps/user_api/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
LINKEDIN_ACCOUNT_MAX_LENGTH = 100
REGION_MAX_LENGTH = 3
ENGLISH_LANGUAGE_LEVEL_MAX_LENGTH = 2
TYPE_OF_DEGREE_MAX_LENGTH = 3
EMPLOYMENT_STATUS_MAX_LENGTH = 3
WORK_EXPERIENCE_LEVEL_MAX_LENGTH = 3
JOB_TITLE_MAX_LENGTH = 63
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def create_account_with_params(request, params): # pylint: disable=too-many-sta
extra_fields["region"] = "required"
extra_fields["city"] = "required"
extra_fields["address_line"] = "optional"
extra_fields["type_of_degree"] = "required"
extra_fields["level_of_education"] = "required"
extra_fields["english_language_level"] = "optional"
extra_fields["employment_status"] = "required"
extra_fields["work_experience_level"] = "required"
Expand Down
26 changes: 0 additions & 26 deletions openedx/core/djangoapps/user_authn/views/registration_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def __init__(self):
"date_of_birth",
"region",
"address_line",
"type_of_degree",
"english_language_level",
"employment_status",
"work_experience_level",
Expand Down Expand Up @@ -666,31 +665,6 @@ def _add_employment_status_field(self, form_desc, required=True):
required=required
)

def _add_type_of_degree_field(self, form_desc, required=True):
"""Add a Type of degree field to a form description.
Arguments:
form_desc: A form description
Keyword Arguments:
required (bool): Whether this field is required; defaults to True
"""
# Translators: This label appears above a field on the registration form
# meant to hold the user's Type of degree.
type_of_degree_label = _("Type of degree")

# Translators: These instructions appear on the registration form, immediately
# below a field meant to hold the user's Type of degree.
type_of_degree_instructions = _("This shows your aquired Type of degree.")

form_desc.add_field(
"type_of_degree",
label=type_of_degree_label,
instructions=type_of_degree_instructions,
restrictions={
"max_length": accounts.TYPE_OF_DEGREE_MAX_LENGTH,
},
required=required
)

def _add_national_id_field(self, form_desc, required=False):
"""Add a national id field to a form description.
Arguments:
Expand Down

0 comments on commit e8190cf

Please sign in to comment.