On Thu, Nov 26, 2009 at 5:49 AM, pinco <p.tessar...@gmail.com> wrote:

> Hi there.
>
> I’m not able to figure out how to solve in a simple and clean way the
> following problem.
> Basically what I want to do is to edit the instances of the following
> model:
>
> Models.py
> class Seller(models.Model):
>    brand = models.CharField(max_length=250)
>  ...
>    slug = models.SlugField(unique=True)
>
> The form is generated using the following code. The validator should
> ensure that the entered brand is unique among the registered users. I
> would use the same form both to create and to edit Seller instances.
>

If you add unique=True to the brand model field (see
http://docs.djangoproject.com/en/dev/ref/models/fields/#unique) then a model
form created for that model will automatically do the uniqueness checking
for you.

Karen

--

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-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to