First, the code of my tests.py def test_get_current(self): m = Member.objects.create(...) q = Question.objects.create(name="q1", text="q1", start_datetime=self.day_before, close_datetime=self.day_after, type=self.type) r = Response.objects.create(question=q, text='response') expected = q, None #self.assertEquals(expected, Question.objects.get_current(m.id))
q2 = Question.objects.create(name="q2", text="q2", start_datetime=self.day_before, close_datetime=self.day_after, type=self.type) #self.assertEquals(expected, Question.objects.get_current(m.id)) MemberResponse.objects.create(member=m, response=r) #expected = q2, None #self.assertEquals(expected, Question.objects.get_current(m.id)) #doesn't work! print Question.objects.all().exclude(response__memberresponse__member=m) print Question.objects.all().exclude(response__memberresponse__member=m) I've got unexpected results in my get_current function, so, I commented it and tried to debug by printing main queryset used inside function and got also strange results: ... Installing index for ... model [<Question: q1>, <Question: q2>] [<Question: q2>] ..... ---------------------------------------------------------------------- Ran 5 tests in 3.125s I'm wondering, why QuerySet with the same arguments returns first wrong data, but by the next call - correct and how can I avoid it? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.