Changes between Initial Version and Version 2 of Ticket #26706
- Timestamp:
- Jun 3, 2016, 5:07:32 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26706 – Description
initial v2 22 22 23 23 The above code prints all the three [m1, m2, m3]. Fetching the tag again using get and printing givens an empty list "[ ]" 24 25 Failing Testcase 26 27 {{{ 28 class Test(TestCase): 29 def test(self): 30 tag = Tag.objects.create(tag='Tag') 31 tag.medias.create(name='A') 32 tag.medias.create(name='B') 33 tag.medias.create(name='C') 34 tag = Tag.objects.prefetch_related('medias').get(id=1) 35 tag.medias.clear() 36 print(tag.medias.all()) 37 }}} 38 39 I guess its related to prefetch_related function.