Answer the question
In order to leave comments, you need to log in
How to send message with forms.py?
forms.py
class UserPasswordResetForm(PasswordResetForm):
def __init__(self, *args, **kwargs):
super(UserPasswordResetForm, self).__init__(*args, **kwargs)
email = forms.EmailField(label='', widget=forms.TextInput(
attrs={'class': 'form-control input_user', 'placeholder': 'Электронная почта'}))
def clean_email(self):
email = self.cleaned_data.get('email')
try:
User.objects.get(email=email)
except User.DoesNotExist:
messages.error(request, 'Пользователя с таким email не существует')
add_message() argument must be an HttpRequest object, not 'module'.
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