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

JU-11 Add the ability to customize the registration fields #580

Merged
merged 1 commit into from
Nov 18, 2021

Conversation

magajh
Copy link
Contributor

@magajh magajh commented Nov 16, 2021

This feature adds the ability to customize the registration form

IMPORTANT
There is a typo HERE that was fixed in this PR #583

Documentation
https://docs.google.com/document/d/1XpVO596QXbx6IAzo88jiHMxH08tCO3s-NXx85TWjrB0/edit

For further context about the implementation, you can refer to the PRs description from the Juniper migration, where the feature was added.

PRs from previous migration
#458
#463
#481
#494

Minor changes in the code for Lilac

  • six.text_type() --> str()
  • isinstance( , six.string_types) --> isinstance(, str)

Testing
Microsite settings

   "EDNX_CUSTOM_REGISTRATION_FIELDS": [
       {
           "label": "Document Type",
           "name": "type_document",
           "options": [
               "DNI",
               "PASSPORT",
               "ID"
           ],
           "type": "select"
       },
       {
           "label": "Document Number",
           "name": "personal_id",
           "type": "text"
       },
       {
           "label": "Phone number",
           "name": "mobile",
           "type": "text"
       },
       {
           "label": "Address",
           "name": "address",
           "type": "text"
       },
       {
           "label": "Company Name",
           "name": "company",
           "type": "text"
       }
   ],
   "REGISTRATION_EXTRA_FIELDS": {
       "address": "required",
       "company": "optional",
       "country": "hidden",
       "gender": "required",
       "goals": "hidden",
       "honor_code": "hidden",
       "level_of_education": "hidden",
       "mailing_address": "hidden",
       "mobile": "required",
       "personal_id": "required",
       "terms_of_service": "required",
       "type_document": "required",
       "year_of_birth": "hidden"
   },
   "REGISTRATION_FIELD_ORDER": [
       "gender",
       "type_document",
       "personal_id",
       "email",
       "mobile",
       "address",
       "company"
   ],
   "extended_profile_fields": [
       "type_document",
       "personal_id",
       "mobile",
       "address",
       "company"
   ]

ju11-a
ju11-b
ju11-c

@magajh magajh changed the title Li/ednx/ju-11 Add the ability to customize the registration fields JU-11 Add the ability to customize the registration fields Nov 16, 2021
"""
custom_fields = getattr(settings, "EDNX_CUSTOM_REGISTRATION_FIELDS", [])
for field in custom_fields:
if field.get("name") == field_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

what if we made this case insensitive? :thinking

Copy link
Contributor Author

@magajh magajh Nov 16, 2021

Choose a reason for hiding this comment

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

@mariajgrimaldi I'm curious as to why do you think that would be useful?

Copy link
Contributor

Choose a reason for hiding this comment

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

       {
           "label": "Celular",
           "name": "mobile",
           "type": "text"
       }
==
       {
           "label": "Celular",
           "name": "Mobile",
           "type": "text"
       }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mariajgrimaldi you're right, I'm changing it. Thankss for the suggestion

Copy link
Contributor Author

@magajh magajh Nov 17, 2021

Choose a reason for hiding this comment

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

@mariajgrimaldi done. I also changed the EXTRA_FIELDS method to avoid duplicates and to also make sure that field_name is always lowercase. What do you think?

@mariajgrimaldi
Copy link
Contributor

can you add optional fields to your tests settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants