“Django Forms Kesalahan Kustomisasi” Kode Jawaban

Django Forms Kesalahan Kustomisasi

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
Bored Bison

Django Forms Kesalahan Kustomisasi

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']
Bored Bison

Jawaban yang mirip dengan “Django Forms Kesalahan Kustomisasi”

Pertanyaan yang mirip dengan “Django Forms Kesalahan Kustomisasi”

Lebih banyak jawaban terkait untuk “Django Forms Kesalahan Kustomisasi” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya