﻿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
26630	Defered constraint checks flush after `post_delete` signal	Alex Madjar		"Repro steps:

1.  Use a database that supports `can_defer_constraint_checks` (tested on postgres)
1.  Have a model (A) with a `null=True` ForeignKey or OneToOneField (F) to another model (B)
1.  Connect a function to listen to `post_delete` on (B) that pulls objects of type (A) from the db (using a = A.objects.get... etc ) 
1.  Try to access a.F for an object a that used to be associated with the deleted instance of B that was just deleted

Expectation:  a.F_id is `None`

Actually:  a.F_id is the id of the deleted instance and a.F raises an ObjectDoesNotExist exception

Note: doesn't repro on fields where `null=False` or on sqlite.  My diagnosis is that A's field isn't being properly cleared (or A objects deleted in the case of on delete CASCADE) because the constraint checks aren't being flushed until _after_ the `post_delete` signal fires"	Bug	closed	Database layer (models, ORM)	dev	Normal	duplicate		Annabelle Wiegart	Accepted	1	0	0	1	0	0
