I am trying to create a custom form field and validate off it. This is version 1.0 of Django.
Here is my form object
class UsernameField(forms.CharField):
def clean(self, values):
print ""
Here is how I call it
class RegisterForm(forms.Form):
username = UsernameField(max_length=30, min_length=4)
password = forms.CharField(widget = forms.PasswordInput(), min_length=5)
password2 = forms.CharField(widget = forms.PasswordInput(), min_length=5)
email = forms.EmailField(max_length=75)
Now I want to keep the default min/max_length checks for a CharField in tack.. but I can't seem to figure how how to do that.
If I put any code into clean() those are not checked. If i try to call parent.clean() i get an error.