How to change the “Support education research…” fields of the registration page?

I had asked this question over on the main edx forums, since it didn’t really look like a tutor-specific thing:

But now that I want to actually try to do that, I have no idea how to do it syntactically in Tutor. Specifically:

You can hide the fields that you don’t want by editing the configuration in your lms.yml.

REGISTRATION_EXTRA_FIELDS:
        city: hidden

I can do simple 1:1 MY_FIELD: BLA type things by copying and pasting plugins I’ve found here, but I don’t know how I’d do a REGISTRATION_EXTRA_FIELDS: city: hidden

Hey @knoise
You are right that the approach is not the same in tutor. In order to accomplish the same, you will have to create a simple yaml plugin, install and enable it. You can see a few example plugins in tutor docs.

Yeah, I’ve copied plugins from elsewhere, but the fact that it’s a 3-entry field instead of a 2-entry field is where I don’t know the right syntax to put. Should it be like:

name: custom_reg_form_plugin
version: 0.1.0
patches:
lms-env: |
“REGISTRATION_EXTRA_FIELDS”: [“city: hidden”]

Or

name: custom_reg_form_plugin
version: 0.1.0
patches:
lms-env: |
“REGISTRATION_EXTRA_FIELDS”: [“city” : “hidden”]

Or something completely different? I kind of don’t want to guess and test on my production platform (I don’t have a dev one at the moment)

I suppose this is extra relevant now too because I found this other Markdown plugin (GitHub - citynetwork/markdown-xblock: An XBlock enabling Open edX course authors to maintain content in Markdown.) which requires multi-line entries in the /edx/etc/{studio|lms}.yml, but which I don’t know how to do with the Tutor plugin syntax.

Hi there,
I updated the repo to dropdown menu (GitHub - murat-polat/custom-form-app: An example app that can be used as a template for extending the registration form in the OpenEdx LMS.). Now you can select nationality from the dropdown menu. In my experience to change existing fields was little bit difficult. But adding new custom fields is OK.
Thanks.

Murat

That’s very cool of you! Unfortunately it’s not working for me yet, but I’m having to fight with this issue too (Is "tutor images build openedx" not cleaning up after itself?)

Basically I modified my

~/.local/share/tutor/env/build/openedx/requirements/custom-form-app/custom_reg_form/migrations/0001_initial.py

to include the pulldown option, and then I ran

tutor images build openedx
tutor local quickstart

But the change didn’t appear. So I also tried

tutor local run lms bash
./manage.py lms migrate custom_reg_form zero
./manage.py lms makemigrations custom_reg_form
./manage.py lms migrate

But I still didn’t see the change. I’ll keep trying once I resize my AMI to get around the “tutor images build openedx” out of space issue.

@qali Have you seen this error?

root@1e0a5feab6be:/openedx/edx-platform# ./manage.py lms makemigrations custom_reg_form
You are trying to add a non-nullable field ‘nationality’ to extrainfo without a default; we can’t do that (the database needs something to populate existing rows).
Please select a fix:

  1. Provide a one-off default now (will be set on all existing rows with a null value for this column)
  2. Quit, and let me add a default in models.py

Hi @knoise ,
Did you installed last one (master) ? and let me know, what does the log say

tutor local logs --tail=100

I tested again today, on my test server, and it’s still working.

We can go further after the your logs… Thanks

Note: after

tutor images build openedx

just run

tutor local quickstart

if you using prod. modus…

My checkout out repo was on the old “solo” branch, so I moved it to the master branch, re-applied my change (I just changed Phone Number to something else) and then ran “tutor images build openedx” and “tutor local quickstart” but still didn’t see the change.

The reason I thought I might need to do the manual migrations is because the quickstart output said the following towards the end:

Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won’t be applied.
Run ‘manage.py makemigrations’ to make new migrations, and then re-run ‘manage.py migrate’ to apply them.
All services initialised.
The Open edX platform is now running in detached mode

Since I can’t upload them, and they’re too long, here’s my logs: https://pastebin.com/F08KBWpV
Nothing jumps out at me as super relevant though…

Hi @knoise ,
Yes, I didn’t see any specific error related your custom_registration plugin or app.
I suggest a brand new installation and remove all other “idle” containers if it’s your test server, not production.

docker system prune -a

than select [ yes ]

Deactivate all other plugins :

tutor plugins list

than

tutor plugins deactivate notes

(for example ) and the other plugins

tutor config save

Remove old repo and private.txt:

sudo rm -rf .local/share/tutor/env/build/openedx/requirements/custom-form-app

sudo rm -rf .local/share/tutor/env/build/openedx/requirements/private.txt

restart your platform to see everything working properly

tutor local quickstart

Than please reinstall new repo from the

Thanks…

Note:
This plugin below must be activated before:

tutor images build openedx


name: custom_form_plugin
version: 0.1.0
patches:
    lms-env: |
      "ADDL_INSTALLED_APPS": ["custom_reg_form"],
      "ENABLE_COMBINED_LOGIN_REGISTRATION": true,
      "REGISTRATION_EXTENSION_FORM": "custom_reg_form.forms.ExtraInfoForm"

    cms-env: |
      "ENABLE_COMBINED_LOGIN_REGISTRATION": true

I don’t have a test system, only production, so I just YOLOed it and did the prune. And I’m glad I did as I saved 20GB!!!

Different error when trying to rebuild the image now, but hopefully that will be resolved soon enough since others should run into it too…

OK, so in the end I got it working, including the drop-down menu (yay!). It turns out it’s been so long since I first used that plugin, I completely forgot there were other places to edit besides 0001_initial.py (namely, the actual probably-primary things of admin.py, forms.py, and models.py!)

So @qali thanks again for making that plugin in the first place, and for updating it to support a pulldown.

p.s., and for my future self: neither just doing a rebuild + quickstart, nor going into bash and applying migrations were independently sufficient to add new fields. I had to do both (with the rebuild happening before the bash migrations)

1 Like

I’m glad it’s began to work. But I believe you using still the old one (solo brach) ? Because, just checkout to master repo is not enough. You may forgot to pull/fatch and install it ? I updated master repo just 3 days ego, and it’s has nationality field as a country dropdown menu , as you see at the screenshut above ?( not just CSV download in admin site) My be I am wrong :slight_smile:

Thanks

1 Like

yes, I’m using master, and it worked. I was referring to the other edits I needed to make to add new fields like a pull down selection for gender.

@knoise I was away and couldn’t follow this. Did you make gender selector work ? As I’d mentioned before, I’ve tried by changing gender to gender2 ( as ‘gender’ is already present in the extra fields ) and got it working. Do you need anymore help ?

I did end up getting it working. I used gender2 during my edits just incase, so that I didn’t have to re-run everything (since it took a long time to build the openedx container when using a non-standard build command.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.