﻿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
2829	I can't clear what looks like a Model-level DB cache	plesur@…	Adrian Holovaty	"It looks like my models are caching their DB query in a way that I can't clear.

If I call ""Model.objects.all()"" and then make any changes to the DB with my MySQL client, the results of subsequent Model.objects.all() invocations never changes.

Example, with model PendingAlert:

>>> PendingAlert.objects.all()
[<PendingAlert: PendingAlert object>, <PendingAlert: PendingAlert object>]

(...now, in mysql...)
mysql> delete from pending_alert;
Query OK, 2 rows affected (0.00 sec)

(...now, back in my Django session)
>>> PendingAlert.objects.all()
[<PendingAlert: PendingAlert object>, <PendingAlert: PendingAlert object>]

...I just verified - the first Django session never clears its cache even if I alter the pending_alert table using Django instead of straight in MySQL.


Just to make sure that I have the right mental model here:  Isn't Model.objects.all() supposed to create a QuerySet with its own search?  Shouldn't these calls be touching the database directly?
"	defect	closed	Database layer (models, ORM)	dev	critical	invalid	windows mysql		Unreviewed	0	0	0	0	0	0
