Django

Code

Changeset 7172

Show
Ignore:
Timestamp:
02/28/08 07:31:11 (9 months ago)
Author:
mtredinnick
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/queryset-refactor/django/core/management/validation.py

    r7126 r7172  
    233233                    if isinstance(f.rel, models.ManyToManyRel): 
    234234                        e.add(opts, '"unique_together" refers to %s. ManyToManyFields are not supported in unique_together.' % f.name) 
     235                    if f not in opts.local_fields: 
     236                        e.add(opts, '"unique_together" refers to %s. This is not in the same model as the unique_together statement.' % f.name) 
    235237 
    236238    return len(e.errors) 
  • django/branches/queryset-refactor/docs/model-api.txt

    r7142 r7172  
    11661166level (i.e., the appropriate ``UNIQUE`` statements are included in the 
    11671167``CREATE TABLE`` statement). 
     1168 
     1169All the fields specified in ``unique_together`` must be part of the current 
     1170model. If you are using `model inheritance`_, you cannot refer to fields from 
     1171any parent classes in ``unique_together``. 
    11681172 
    11691173**New in Django development version**