4.4. Adding Custom Fields to the Registration Page#
This topic describes how to add custom fields to the registration page for your instance of Open edX.
By default, the registration page for each instance of Open edX has fields that ask for information such as a user’s name, country, and highest level of education completed. You can add custom fields to the registration page for your own Open edX instance. These fields can be different types, including text entry fields and drop-down lists.
4.4.2. Add Custom Fields to the Registration Page#
Before you add a custom field to the registration page, you must make sure that
the combined sign-in and registration form is enabled for your Open edX
instance. To do this, open the
studio.yml files, and
ENABLE_COMBINED_LOGIN_REGISTRATION feature flag to True. These
files are located one level above the
edx- platform directory.
To add custom fields to the registration page, follow these steps.
Start and sign in to your instance of Open edX.
Use Python to create a Django form that contains the fields that you want to add to the page, and then create a Django model to store the information from the form.
For more information about how to create Django forms, see Django Forms on the Django website.
lms.ymlfile, add the app for your model to the
lms.ymlfile, set the
REGISTRATION_EXTENSION_FORMsetting to the path of the Django form that you just created, as a dot- separated Python string.
For example, if your form is named “ExampleExtensionForm” and is located at “path/to/the_form.py”, the value of the setting is
Run database migrations.
Restart the LMS and verify that the new fields appear on your registration form.
For an example app for custom forms, see the OpenCraft custom_form_app page in GitHub.