Re: Customizing error message in ModelForm

2011-04-15 Thread het.oosten
Yes indeed! Thank you very much for your help. Rob -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@goog

Re: Customizing error message in ModelForm

2011-04-15 Thread Martin Pajuste
This should do the trick: class PrijsvraagForm(ModelForm): mail = forms.EmailField(error_messages={'required':'Vul aub een geldig Email adres in', 'invalid': 'Het email adres is niet geldig'}) class Meta: model = Prijsvraag def clean_code(self): super(PrijsvraagForm,

Re: Customizing error message in ModelForm

2011-04-15 Thread het.oosten
@Martin Thank you for your reply. I tried to do this, but I still get the default error message (the custom error from the code field works as it should): from django.db import models from django.forms import ModelForm from django import forms class Prijsvraag(models.Model): naam = mode

Re: Customizing error message in ModelForm

2011-04-15 Thread Martin Pajuste
Error messages in ModelForms work perfectly fine. class PersonForm(forms.ModelForm): first_name = forms.CharField(error_messages={'required': 'Please enter your first name!'}) class Meta: model = Person http://docs.djangoproject.com/en/dev/ref/forms/fields/#error-messages -- Y

Customizing error message in ModelForm

2011-04-15 Thread het.oosten
I want to show a custom error message in a Modelform. With a normal form I can add an error message like this: error_messages={'required': 'Vul aub een geldig Email adres in', 'invalid': 'Het email adres is niet geldig'} With a ModelForm this won't work. Is there a way to add a custom error messa