django
django copied to clipboard
Refs #28147 -- Fixed loss of assigned parent when saving GenericForeignKey after parent.
Follows on from "Fixed #33004 -- Made saving objects with unsaved GenericForeignKey raise ValueError."
Aims to allow saving a GenericForiegnKey
after the parent (see test_save_generic_foreign_key_after_parent
),
without removing the ability to save the fk_field
of the GenericForeignKey
as None and that nulling out the GenericForiegnKey
value (see test_assign_gfk_id_none
).
We should also check if this doesn't introduce a regression as https://github.com/django/django/commit/519016e5f25d7c0a040015724f9920581551cab0 (fixed in https://github.com/django/django/commit/4122d9d3f1983eea612f236e941d937bd8589a0d).
The only solution I have found so far to prevent the regression is probably quite hacky/flakey. Look forward to the suggestions people have as to how it can be improved :+1: