Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PADV-1556 Create custom form for registration extra fields. #129

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

Nekenhei
Copy link

@Nekenhei Nekenhei commented Sep 10, 2024

Tickets

Description

Change REGISTRATION_EXTENSION_FORM platform setting and turns it into a site awareness feature

Changes Made

  • Make REGISTRATION_EXTENSION_FORM site awareness by pulling it from configuration_helpers instead of platform settings

How To Test

This feature could be fully tested along with https://github.com/Pearson-Advance/pearson-core/pull/53

Nonetheless, you could follow the next steps to test it into the platform:

  • Simply set the REGISTRATION_EXTENSION_FORM key into the the site configurations of a enabled site into your edx-platform instance with a string based value
  • Place a debugger and/or print statement of its value
  • Access to the registration form of the affected site and confirms that the setting is being pulled

@Nekenhei Nekenhei requested a review from Squirrel18 September 10, 2024 17:39
@@ -298,13 +298,15 @@ 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 REGISTRATION_EXTENSION_FORM.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of adding site configuration support to a Django setting is to support both the site configuration and the default Django configuration. We should not remove backwards compatibility in case there are no sites configured or it is a single site installation. @Nekenhei

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'll implement a solution that prioritize the site configurations over the platform settings.

return None
module, klass = settings.REGISTRATION_EXTENSION_FORM.rsplit('.', 1)
# No Default valued is passed since we prioritize site configurations over site settings.
registration_extra_form = configuration_helpers.get_value('REGISTRATION_EXTENSION_FORM',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep checking the existence of the default value, as it's now, it will throw an error if the setting is not present. Also if the setting is present but is None, it will fail on line 310. @Nekenhei

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Squirrel18 you're right, I've removed by error an if statement that handles the situation when none of the sources has the setting set.

In the original code, the default value was none, so I changed to firstly check for site conf, then plataform settings and if none of them are presented, return None as it's working on master.

@Nekenhei Nekenhei merged commit 4ae1637 into pearson-release/olive.stage Sep 18, 2024
14 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants