From 66471bbdd2fce8f35e845d6f0ef7a5be624d3e7f Mon Sep 17 00:00:00 2001 From: Esteban Giraldo Date: Tue, 10 Sep 2024 12:32:37 -0500 Subject: [PATCH] feat: registration extension form site awareness --- .../user_authn/views/registration_form.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/user_authn/views/registration_form.py b/openedx/core/djangoapps/user_authn/views/registration_form.py index 8eb005cbc04b..bec90a5f3392 100644 --- a/openedx/core/djangoapps/user_authn/views/registration_form.py +++ b/openedx/core/djangoapps/user_authn/views/registration_form.py @@ -298,13 +298,18 @@ def cleaned_extended_profile(self): def get_registration_extension_form(*args, **kwargs): """ - Convenience function for getting the custom form set in settings.REGISTRATION_EXTENSION_FORM. + Convenience function for getting the custom form set in site configurations or plataform settings + REGISTRATION_EXTENSION_FORM. - An example form app for this can be found at http://github.com/open-craft/custom-form-app + Documentation on how to enable this feature can be found on + https://github.com/Pearson-Advance/pearson-core/blob/master/docs/pearson_core_features.md#amazon-custom-registration-form """ - if not getattr(settings, 'REGISTRATION_EXTENSION_FORM', None): + # No Default valued is passed since we prioritize site configurations over site settings. + registration_extra_form = configuration_helpers.get_value('REGISTRATION_EXTENSION_FORM', + settings.REGISTRATION_EXTENSION_FORM) + if not registration_extra_form: return None - module, klass = settings.REGISTRATION_EXTENSION_FORM.rsplit('.', 1) + module, klass = registration_extra_form.rsplit('.', 1) module = import_module(module) return getattr(module, klass)(*args, **kwargs)