Add Job Title field to Registration Page

Add 'Job Title' as configurable field on the registration page.
Job Title will be saved to the 'meta' field of the 'userprofile' table.
This commit is contained in:
Bessie Steinberg
2017-11-02 09:02:38 -04:00
parent ca46bfcf06
commit b340174e12
3 changed files with 22 additions and 2 deletions

View File

@@ -427,12 +427,13 @@ def _get_extended_profile_fields():
"state": _(u"State/Province/Region"),
"company": _(u"Company"),
"title": _(u"Title"),
"job_title": _(u"Job Title"),
"mailing_address": _(u"Mailing address"),
"goals": _(u"Tell us why you're interested in {platform_name}").format(
platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME)
),
"profession": _("Profession"),
"specialty": _("Specialty")
"profession": _(u"Profession"),
"specialty": _(u"Specialty")
}
extended_profile_field_names = configuration_helpers.get_value('extended_profile_fields', [])

View File

@@ -144,6 +144,7 @@ class RegistrationFormFactory(object):
"year_of_birth",
"level_of_education",
"company",
"job_title",
"title",
"mailing_address",
"goals",
@@ -652,6 +653,23 @@ class RegistrationFormFactory(object):
required=required
)
def _add_job_title_field(self, form_desc, required=False):
"""Add a Job Title field to a form description.
Arguments:
form_desc: A form description
Keyword Arguments:
required (bool): Whether this field is required; defaults to False
"""
# Translators: This label appears above a field on the registration form
# which allows the user to input the Job Title
job_title_label = _(u"Job Title")
form_desc.add_field(
"job_title",
label=job_title_label,
required=required
)
def _add_first_name_field(self, form_desc, required=False):
"""Add a First Name field to a form description.
Arguments:

View File

@@ -1731,6 +1731,7 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase):
"level_of_education",
"company",
"title",
"job_title",
"mailing_address",
"goals",
"honor_code",