tags:

views:

34

answers:

1

this code:

class TribeForm(forms.ModelForm):

    slug = forms.SlugField(max_length=20,
        help_text = _("a short version of the name consisting only of letters, numbers, underscores and hyphens."),
        error_message = _("This value must contain only letters, numbers, underscores and hyphens.")
        )

    def clean_slug(self):
        if Tribe.objects.filter(slug__iexact=self.cleaned_data["slug"]).count() > 0:
            raise forms.ValidationError(_("A tribe already exists with that slug."))
        return self.cleaned_data["slug"].lower()

    def clean_name(self):
        if Tribe.objects.filter(name__iexact=self.cleaned_data["name"]).count() > 0:
            raise forms.ValidationError(_("A tribe already exists with that name."))
        return self.cleaned_data["name"]

    class Meta:
        model = Tribe
        fields = ('name', 'slug', 'description')

when i use django 1.1 ,it is ok,

but ,when i use django svn version,it is error: why ??

url's error??

alt text

A: 

It's saying error_message was an unexpected keyword argument. Try error_messages instead: http://docs.djangoproject.com/en/dev/ref/forms/fields/#error-messages

Koobz
It's bizarre that it works in 1.1. Maybe they deprecated error_message (singular) and it hasn't been until now that they've enforced the plural form.
Koobz