mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
queryset-refactor: Head off any attempts to use unique_together across inherited models.
We don't support check constraints and triggers, so trying to do this would be optimistic at best. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a9008f8928
commit
7c54780497
@ -232,5 +232,7 @@ def get_validation_errors(outfile, app=None):
|
|||||||
else:
|
else:
|
||||||
if isinstance(f.rel, models.ManyToManyRel):
|
if isinstance(f.rel, models.ManyToManyRel):
|
||||||
e.add(opts, '"unique_together" refers to %s. ManyToManyFields are not supported in unique_together.' % f.name)
|
e.add(opts, '"unique_together" refers to %s. ManyToManyFields are not supported in unique_together.' % f.name)
|
||||||
|
if f not in opts.local_fields:
|
||||||
|
e.add(opts, '"unique_together" refers to %s. This is not in the same model as the unique_together statement.' % f.name)
|
||||||
|
|
||||||
return len(e.errors)
|
return len(e.errors)
|
||||||
|
@ -1166,6 +1166,10 @@ together. It's used in the Django admin and is enforced at the database
|
|||||||
level (i.e., the appropriate ``UNIQUE`` statements are included in the
|
level (i.e., the appropriate ``UNIQUE`` statements are included in the
|
||||||
``CREATE TABLE`` statement).
|
``CREATE TABLE`` statement).
|
||||||
|
|
||||||
|
All the fields specified in ``unique_together`` must be part of the current
|
||||||
|
model. If you are using `model inheritance`_, you cannot refer to fields from
|
||||||
|
any parent classes in ``unique_together``.
|
||||||
|
|
||||||
**New in Django development version**
|
**New in Django development version**
|
||||||
|
|
||||||
For convenience, unique_together can be a single list when dealing
|
For convenience, unique_together can be a single list when dealing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user