python - django user creation form required keyerror -
i made custom registration form, inherits usercreationform . however, when try submit, 1 of fields empty, keyerror on required. seems happen somewhere in django source code, i'm pretty sure comes because of custom clean method. form: class registrationform(usercreationform): """ edit user registration form add emailfield """ class meta: model = user fields = ('username', 'password1', 'password2') def __init__(self, *args, **kwargs): super(registrationform, self).__init__(*args, **kwargs) #add custom errormessages self.fields['username'].error_messages = { 'invalid': 'invalid username' } self.fields['password2'].label = "confirm password" #make sure username lowered , unique def clean_username(self): username = self.cleaned_data.get('username') try: u...