﻿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
35965	GenericForeignKeys lose the assigned unsaved object after the object is saved	Willem Van Onsem	YashRaj1506	"As mentioned on [https://stackoverflow.com/q/79244238/67579 StackOverflow], a `ForeignKey` can still save an object if the object was not saved when setting the model object, like:

{{{
one = Model_One()
two = Model_Two(model_one=one)
one.save()
two.save()
}}}

But this is not the case for a `GenericForeignKey` with:

{{{
one = Model_One()
two = Model_With_GFK(content_object=one)
one.save()
two.save()
}}}

This is because the `content_object` *immediately* sets the content type field and the foreign key field when setting the object, and then leaves is that way.

Perhaps overkill, but it might be worth to do the same for a `ForeignKey` and thus check if the object has been given `.pk`, and if so, set the foreign key field."	Bug	assigned	contrib.contenttypes	5.1	Normal				Accepted	0	0	0	0	0	0
