Wednesday, January 26, 2011

RE: forbid clones

Have a look at unique_together:
Django | Model Meta options | Django documentation
http://docs.djangoproject.com/en/dev/ref/models/options/

Jump to unique_together‎: Options.unique_together¶. Sets of field names that, ... For convenience, unique_together can be a single list when dealing ...
docs.djangoproject.com/en/dev/ref/models/options/
Labeled Latest docs 1.0 docs All docs


-----Original Message-----
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Jaroslav Dobrek
Sent: 26 January 2011 14:26
To: Django users
Subject: Re: forbid clones

>
> http://docs.djangoproject.com/en/1.2/ref/models/fields/#unique

Although this does help, it leaves one question open:

How can we forbid only such pairs of objects that have the same value
in all of their attributes.

Example:

This should be allowed:

car1: manufacturer = "foo", name = "bar"
car2: manufacturer = "foo", name = "baz"

This should not be allowed:

car1: manufacturer = "foo", name = "bar"
car2: manufacturer = "foo", name = "bar"


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

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

No comments:

Post a Comment