﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26364	Updating an object in a queryset with save() leads to bug using that queryset as a lookup filter	jonathan-golorry	nobody	"If an object in a queryset is updated using the save() method, it is updated for future accesses to that queryset, implying the queryset is storing the object properly. However, if the queryset is used as an object set in a filter for a future lookup, the queryset does not represent the updated objects properly.

Partial example:
{{{
class Foo(models.Model):
    state = models.CharField(max_length=30)

class Bar(models.Model):
    parent = models.OneToOneField(Foo)
}}}

{{{
foos = Foo.objects.all()
for foo in foos:
    foo.state = ""Updated""
    foo.save()
bars = Bar.objects.filter(parent__in=foos)
}}}

Because the objects are updated before they are used in the Bar filter, they aren't recognized and the bars queryset will be empty."	Bug	closed	Database layer (models, ORM)	1.9	Normal	wontfix			Unreviewed	0	0	0	0	0	0
