Skip to content

Instantly share code, notes, and snippets.

@chriskief
Created October 24, 2013 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskief/7130775 to your computer and use it in GitHub Desktop.
Save chriskief/7130775 to your computer and use it in GitHub Desktop.
class RegisterForm(forms.ModelForm):
username = forms.CharField(max_length=User._meta.get_field('username').max_length)
email = forms.CharField(max_length=User._meta.get_field('email').max_length, widget=HTML5EmailInput())
password = forms.CharField(min_length=6, max_length=16, widget=forms.PasswordInput())
# the request is now available, add it to the instance data
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request')
super(RegisterForm, self).__init__(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment