You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because, when the blog_person_relationship child object is deserialised, foreign keys including the ParentalKey to Page are integrity-checked according to the on_delete property. Since there is no existing Page in the database with ID 999, and the ParentalKey has on_delete=CASCADE, the deserialisation logic decides that the child object should not exist, and drops it from the relation. Clearly, this is wrong - it should be able to recognise from the fact that it's a ParentalKey that the parent object is being created at the same time as the child object, and thus skip over the check for it existing in the database.
For a ParentalKey with on_delete=PROTECT, this has a different effect: since the dangling-foreign-key check does not implement a case for PROTECT, deserialisation fails with "can't currently handle on_delete types other than CASCADE, SET_NULL and DO_NOTHING". (For a legitimate dangling foreign key, this would not be entirely a bad thing, since the logical outcome would be an IntegrityError anyway; however, in this case we ought to be skipping that check entirely.)
The text was updated successfully, but these errors were encountered:
On a fresh bakerydemo install:
However:
This is because, when the
blog_person_relationship
child object is deserialised, foreign keys including the ParentalKey to Page are integrity-checked according to the on_delete property. Since there is no existing Page in the database with ID 999, and the ParentalKey has on_delete=CASCADE, the deserialisation logic decides that the child object should not exist, and drops it from the relation. Clearly, this is wrong - it should be able to recognise from the fact that it's a ParentalKey that the parent object is being created at the same time as the child object, and thus skip over the check for it existing in the database.For a ParentalKey with on_delete=PROTECT, this has a different effect: since the dangling-foreign-key check does not implement a case for PROTECT, deserialisation fails with "can't currently handle on_delete types other than CASCADE, SET_NULL and DO_NOTHING". (For a legitimate dangling foreign key, this would not be entirely a bad thing, since the logical outcome would be an IntegrityError anyway; however, in this case we ought to be skipping that check entirely.)
The text was updated successfully, but these errors were encountered: