Commit 44984d78037f2d5b476f70463715133da7d5b71f
1 parent
531f839a
Exists in
master
and in
5 other branches
Validation in form for edit #211
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
app/forms.py
1 | 1 | from django import forms |
2 | +from django.core.validators import validate_email | |
2 | 3 | from .models import EmailBackend |
3 | 4 | from django.utils.translation import ugettext_lazy as _ |
4 | 5 | |
5 | 6 | class EmailBackendForm(forms.ModelForm): |
6 | 7 | |
8 | + def clean_default_from_email(self): | |
9 | + default_email = self.cleaned_data['default_from_email'] | |
10 | + validate_email(default_email) | |
11 | + return default_email | |
12 | + | |
7 | 13 | class Meta: |
8 | 14 | model = EmailBackend |
9 | 15 | fields = ('description', 'host', 'port', 'username', 'password', 'safe_conection', 'default_from_email') | ... | ... |