Answer the question
In order to leave comments, you need to log in
How to use whitelist when validating a form?
Hi all!
Generally somehow so tried to make a call of the white list in the form. But I don't get it right.
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.forms import EmailField
from django.core.validators import EmailValidator
class SignupForm(UserCreationForm):
email = forms.EmailField(validators=[EmailValidator(whitelist=['@iuca.kg'])])
class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question