Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django forms error customize

class AccountForm(forms.Form):
    email = forms.EmailField(max_length=255)
    username = forms.CharField(max_length=40)
    password = PasswordField(label="Password")
    password_confirm = PasswordField(label="Password")

    def clean(self):
        cd = self.cleaned_data
        if cd.get('password') != cd.get('password_confirm'):
            self.add_error('password_confirm', "passwords do not match !")
        return cd
Comment

django forms error customize

class AccountForm(forms.Form):
    ....your stuff

    def clean_password(self):
        if self.data['password'] != self.data['password_confirm']:
            raise forms.ValidationError('Passwords are not the same')
        return self.data['password']
Comment

PREVIOUS NEXT
Code Example
Python :: python cls command line 
Python :: concatenation of array in python 
Python :: np.exp in python numpy 
Python :: how to use assert in python 
Python :: import login required 
Python :: date time shit pandas 
Python :: pandas drop duplicates but keep most recent date 
Python :: zip a directory in python 
Python :: upload file to s3 
Python :: list pakages installed in python 
Python :: python delete dictionary key 
Python :: installing python3.9 on linux mint 20 
Python :: how change column strin of list data type to list 
Python :: how to set pandas dataframe as global 
Python :: python check if object is empty 
Python :: python multithreading 
Python :: beautifulsoup getting data from a website 
Python :: re python3 
Python :: plt python two axis 
Python :: using Decorators 
Python :: f readlines python not working 
Python :: how to sort a list in python 
Python :: python default keyword parameter list 
Python :: flask send email gmail 
Python :: Looping and counting in python 
Python :: text classification 
Python :: python for unity 
Python :: python A string float numeral into integer 
Python :: close a file python 
Python :: numpy evenly spaced numbers 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =