#15146: Reverse relations include unsaved objects (NULL id)
---------------------------+------------------------------------------------
 Reporter:  treyh          |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  1.2       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 Model with '''parent''' relation and '''children''' reverse relation:

 {{{
 class TestModel(models.Model):
     parent = models.ForeignKey('self', blank=True, null=True,
 related_name='children')
 }}}



 Bug found while using model:


 {{{
 t = TestModel()
 t.save()
 u = TestModel()
 u.children.all() # Incorrectly returns: [<TestModel: TestModel object>]
 u.save()
 u.children.all() # Correctly returns: []
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15146>
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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to