Skip to content

Instantly share code, notes, and snippets.

@ceoro9
Created February 3, 2018 08:57
Show Gist options
  • Save ceoro9/64162658699cf93d63117d1e9a276922 to your computer and use it in GitHub Desktop.
Save ceoro9/64162658699cf93d63117d1e9a276922 to your computer and use it in GitHub Desktop.
Create custom form for signup using UserCreationForm
class myUserCreationForm(UserCreationForm):
#additional fields
class Meta:
model = User
fields = ('username', 'password1', 'password2')
def __init__(self, *args, **kwargs):
super(UserCreationForm, self).__init__(*args, **kwargs)
#set classes for css
self.fields['username'].widget.attrs['class'] = 'form-control'
self.fields['password1'].widget.attrs['class'] = 'form-control'
self.fields['password2'].widget.attrs['class'] = 'form-control'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment