Search code examples
pythondjangodjango-registration

How to add custom-fields (First and Last Name) in django-registration 2.2 (HMAC activation Workflow)?


There are already some question on this but most of their answers are using models based workflow which is not a recommended way anymore according to django-registration. I am just frustrated from last week, trying to figure out how to add first and last name fields in registration form in HMAC Workflow.


Solution

  • I am using the HMAC workflow and extended the registrationform, then overwrite the save method to also save the fields that you want to add. Don't forget to add to override the views and make them your new form.

    from registration.forms import RegistrationForm
    class RegisterForm(RegistrationForm):
        first_name = models.CharField()