ZXCA
ZXCA

Reputation: 91

django-registration adding additional fields in the registration form

I am interested in adding additional fields in the registration form, like nickname and date of birth.

I am using django-registration 0.8, and I am planning to write my own custom form. I have looked at django-profiles and I think that the privacy control with that is not strong enough.

I plan to store these additional info in another database (mongodb) where I have direct access to them via a variable ( my_db). Which function should I overwrite in order to control where the data from the custom form will go to?

Upvotes: 2

Views: 639

Answers (1)

leech
leech

Reputation: 8431

The register view allows you to pass a custom form_class. From registration.views:

def register(request, success_url=None,
             form_class=RegistrationForm, profile_callback=None,
             template_name='registration/registration_form.html',
             extra_context=None):

Subclass the RegistrationForm and override the save method on that and put your custom stuff in there. Then override the view in your project's urlconf.

url(r'registration/', register, {"form_class": YourNewRegistrationForm}),

Upvotes: 7

Related Questions