Created
September 8, 2010 19:39
-
-
Save vbmendes/570698 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
""" | |
Você pode criar a mensagem no próprio form. | |
""" | |
from django import forms | |
from django.forms.util import ErrorList | |
from models import UserDoc | |
class DocForm(forms.ModelForm): | |
class Meta(): | |
model = UserDoc | |
def clean(self): | |
cleaned_data = super(DocForm, self).clean() | |
if self.errors and not self.errors.has_key('nome_do_campo_file'): | |
self.errors['nome_do_campo_file'] = ErrorList() | |
self.errors['nome_do_campo_file'].append(u'Não esqueça de reenviar o arquivo.') | |
return cleaned_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
Ou pode colocar diretamente no template. | |
{% endcomment %} | |
{% if form.errors %} | |
Não esqueça de reenviar o arquivo. | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment