I've written that part of form subclass:
def clean_title(self):
data = self.cleaned_data['title']
counter = Article.objects.filter(title__iexact = data).count()
if counter > 0:
raise forms.ValidationError('my message')
return data
Is that right?
--
You
Could You give me some frame, how it should be? I've never done it before:/
I have that added:
def clean_title(self):
data = self.cleaned_data['title']
return data
But how to check if that field is unique? Is there some special way, or just
to write simple query to check it?
--
Y
Could You give me some frame, how it should be? I've never done it before:/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django
You can do this by creating a custom clean function for your field:
http://docs.djangoproject.com/en/1.2/ref/forms/validation/
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups
4 matches
Mail list logo