Created
February 3, 2018 08:57
-
-
Save ceoro9/64162658699cf93d63117d1e9a276922 to your computer and use it in GitHub Desktop.
Create custom form for signup using UserCreationForm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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