*Ticket link : *https://code.djangoproject.com/ticket/30382
*Problem : *When saving we pass force_insert=True to prevent the extra UPDATE statement that precedes the INSERT. The force_insert flag is respected on the child table but not on the parent. *The main problem : *On our first go this issue would seem an easy picking as we just have to pass the force_insert flag while saving the parents, but as mentioned here <https://code.djangoproject.com/ticket/30382#comment:2> it is going to create a disaster of integrity errors in the Model.objects.create() method with non-abstract inherited parents as the create method assumes force_insert=True. *Approach 1: *Set the force_insert=False inside create method if that contains a non-abstract parent model. The problem with it is it generates an extra query while creating the non abstract parent model when the child exists, more details can be found here... <https://github.com/django/django/pull/16830#issuecomment-1540182568> (Tried in the PR) *Approach 2: *Pass an extra flag to the save method and if the method call is coming from create then prevent passing force_insert flag(i.e set it to false) while saving parents when called via create, but as we cannot change the signature of the save method we cannot simply take an extra flag, so this comes down to a very simple question : *How to pass a flag to a python method without changing its signature:* I can think of three approaches for this, 1. Inspecting a stack frame(Deprecated because of performance issues) - Tried in the PR 2. Using a global variable (Deprecated because of performance issues) 3. Using a class variable (Deprecated because of backward compatibility as names can collide with method, variable, property name of a model) - Tried in the PR *PR link :* https://github.com/django/django/pull/16830 -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/fd92a1b1-cc0f-4800-ad61-33a098959707n%40googlegroups.com.