Install Custom Registration Form Plugin on Tutor

You getting error, because your changes must override old models and migrations. To do that

$ tutor local run lms bash

To delete old migrations

$ ./manage.py lms migrate custom_reg_form zero

$ tutor images build openedx

$ tutor local quickstart # you should see new migrations, if not ? just run

$ tutor local run lms bash

$ ./manage.py lms makemigrations

$ ./manage.py lms migrate

2 Likes

great its work thank you very much :star_struck : :innocent:

1 Like

can you share source code of this plugin?

Hi @ejklock,
If this question to me ? Some fork of this repository https://github.com/open-craft/custom-form-app. has good examples. And I agree with you about sharing our experiences and codes. If has not some private or organizational information’s.
Thanks,
Murat

2 Likes

With the help of @ak00001 I could make a few new fields to display on registration page, but on clicking register it freezes and Create Account button greys out.
(Running on Koa)
log tail-100


@regis @qali @ak00001 Can you please help me to resolve this ?

Hi @nadheemabdulla,
It looks like migrations problem, you must rebuild container(production env) after your changes on models, forms and migrations file.

$ tutor images build openedx

$ tutor local quickstart # you should see new migrations, if not ? just run

$ tutor local run lms bash

$ ./manage.py lms makemigrations

$ ./manage.py lms migrate

Thank you so much for the response.
I tried this again-

New registration field is shown but freezes while clicking on Create account
So I tried

which lists

migrations for 'shoppingcart':
  lms/djangoapps/shoppingcart/migrations/0005_auto_20201224_0102.py
    - Remove field course_enrollment from certificateitem
    - Remove field orderitem_ptr from certificateitem
    - Remove field created_by from coupon
    - Remove field coupon from couponredemption
    - Remove field order from couponredemption
    - Remove field user from couponredemption
    - Remove field orderitem_ptr from courseregcodeitem
    - Delete model CourseRegCodeItemAnnotation
    - Remove field created_by from courseregistrationcode
    - Remove field invoice from courseregistrationcode
    - Remove field invoice_item from courseregistrationcode
    - Remove field order from courseregistrationcode
    - Remove field invoiceitem_ptr from courseregistrationcodeinvoiceitem
    - Remove field orderitem_ptr from donation
    - Remove field changed_by from donationconfiguration
    - Remove field invoice from invoicehistory
    - Remove field invoice from invoiceitem
    - Remove field created_by from invoicetransaction
    - Remove field invoice from invoicetransaction
    - Remove field last_modified_by from invoicetransaction
    - Remove field user from order
    - Remove field order from orderitem
    - Remove field user from orderitem
    - Remove field course_enrollment from paidcourseregistration
    - Remove field orderitem_ptr from paidcourseregistration
    - Delete model PaidCourseRegistrationAnnotation
    - Remove field course_enrollment from registrationcoderedemption
    - Remove field order from registrationcoderedemption
    - Remove field redeemed_by from registrationcoderedemption
    - Remove field registration_code from registrationcoderedemption
    - Delete model CertificateItem
    - Delete model Coupon
    - Delete model CouponRedemption
    - Delete model CourseRegCodeItem
    - Delete model CourseRegistrationCode
    - Delete model CourseRegistrationCodeInvoiceItem
    - Delete model Donation
    - Delete model DonationConfiguration
    - Delete model Invoice
    - Delete model InvoiceHistory
    - Delete model InvoiceItem
    - Delete model InvoiceTransaction
    - Delete model Order
    - Delete model OrderItem
    - Delete model PaidCourseRegistration
    - Delete model RegistrationCodeRedemption

on running

I get

MySQLdb._exceptions.ProgrammingError: (1146, "Table 'openedx.shoppingcart_certificateitem' doesn't exist")
django.db.utils.ProgrammingError: (1146, "Table 'openedx.shoppingcart_certificateitem' doesn't exist")

Here is the log

Thank you again for your time.

Hi,
Actually like this error below was my expectation about custom register form.

django.db.utils.OperationalError: (1054, “Unknown column ‘org_inst’ in ‘field list’”)

But there are many different error which is mostly ecommerce related ? Such as this error below

(1146, “Table ‘openedx.shoppingcart_certificateitem’ doesn’t exist”)

But any way, what kind of custom fields do you want to in your registrations form ? So we can try to make a demo for that.

Thanks

1 Like

This is actually a very bad idea which is likely to break your platform.

1 Like

Hi @regis and thanks for warning,
But is it related to Koa or? because after changes on custom models, forms, fields I always use same commands ?

Thanks…

1 Like

This is not specific to Koa – at least, not that I know of. If you make changes to certain models, then yes you will want to generate migrations, but not for all models. Instead, you probably want to generate models only for your customized application. For instance:

./manage.py lms makemigrations custom_reg_form
3 Likes

Thanks for clarification @regis and sorry for that @nadheemabdulla
I thought that

./manage.py lms makemigrations

effects just models which has been changed(custom_reg_form) after last migrations, not all LMS, CMS… But I will remember that thanks :slight_smile:

1 Like

Thanks again for the help.

I would like to add 1. Gender ( not optional) 2. Date of birth 3. Mobile number and 4 Nationality

to see if it works, I used this fork of Opencraft Custom-form-app (as Opencraft custom form app’s django version is incompatible with Koa)

Thank you so much @regis and @qali !

I’ll try with this.

Hi @nadheemabdulla,
Here is a little demo which is consist of just one extra field(phone number).


It works and has possibility download data as CSV format, from the Django admin side. Actually I tried to make “Gender” and " Date of birth" as Required fields, but that was not easy for me, bacause overridding fileds which already exist, effects the other fields. But you can try that on your test server. And this example from Appsembler

may can help you for overidding existing files.

Thanks and god luck !

2 Likes

Thanks for the help @qali
I’ll try this way.

Hi @qali I could make the phone number field working.
Thank you so much! :heart:

1 Like

@qali on your page it also says you can “download all information from the Django admin site as a CSV file”. Can you provide some guidance for how the Django download works, in the repo documentation? I don’t see anything jumping out at me for how to download the data when I go to the Django interface.

@oedx You can access the added registration information on django admin at http://lmsdomain.com/admin

  • sign-in with the admin username and password
  • Go to Extra infos under CUSTOM_REG_FORM
  • You can see all the extra registration information listed.
  • Select the users you are interested in and choose download CSV from Actions and Go
1 Like

The problem is that when I go to the Django admin page and search for “Extra” or “CUSTOM_REG_FORM”, I get no hits (neither do I see it when eyeballing it alphabetically). I can see that the custom registration form is in effect through when I sign out and go to register, so I know the plugin is working.

Edit: Oh wow, usually I’m just lazy so I edit my studio.LMS.com/ URL to be studio.LMS.com/admin to get to Django. But I just found out that it’s only if I go to LMS.com/admin (not prepended with studio) that I can see the CUSTOM_REG_FORM entry! Accidentally learned something today!