#15321: Models._get_unique_checks() does not return grandparents' unique checks
------------------------------------------+---------------------------------
 Reporter:  jku                           |          Owner:  nobody    
   Status:  new                           |      Milestone:            
Component:  Database layer (models, ORM)  |        Version:  1.2       
 Keywords:  models, unique checks         |   Triage Stage:  Unreviewed
Has patch:  0                             |  
------------------------------------------+---------------------------------
 Consider the following models:

 {{{
 #!python
 class Project(models.Model):
     title = models.CharField(max_length=255)
     internal_id = models.CharField(max_length=255, unique=True)

 class SubProject(Project):
     # ... fields of SubProject ...
     pass

 class SubSubProject(SubProject):
     # ... fields of SubSubProject ...
     pass
 }}}

 Following code works as expected (b.full_clean() throws a
 ValidationError):

 {{{
 #!python
 a = SubProject( title = 'A', internal_id = 1 )
 a.save()
 b = SubProject( title = 'B', internal_id = 1 )
 b.full_clean() # Throws ValidationError
 }}}

 Following code does not work as expected (b.full_clean() does not throw an
 exception, b.save() throws an IntegrityError):

 {{{
 #!python
 a = SubSubProject( title = 'A', internal_id = 2 )
 a.save()
 b = SubSubProject( title = 'B', internal_id = 2 )
 b.full_clean() # Does not throw any exception!
 b.save() # Throws IntegrityError, of course!
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15321>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to