Re: Ticket #30382 force_insert flag is not passed when saving parents on inherited models

2023-06-08 Thread Akash Sen
Also the current method initially tries to UPDATE, if not UPDATED then it tries to INSERT. So the case of having consecutive UPDATES is already optimized with minimum possible number of queries. On Friday, June 9, 2023 at 12:10:18 AM UTC+5:30 charettes wrote: > Sarah, not a stupid question at a

Re: Ticket #30382 force_insert flag is not passed when saving parents on inherited models

2023-06-08 Thread charettes
Sarah, not a stupid question at all. While `force_update` is a somewhat opposite of `force_insert` there are nuances in how they are handled in the face of MTI (multi-table inheritance). The proposed issubclass'esque additional signature (ModelBase | tuple[ModelBase]) works in the case of `for

Re: Ticket #30382 force_insert flag is not passed when saving parents on inherited models

2023-06-08 Thread Sarah Boyce
+1 Looking at the PR it looks like a boolean is still an accepted value for force_insert which is nice as the feature looks to be used quite a bit (just a rough idea https://github.com/search?type=code&auto_enroll=true&q=force_insert%3DTrue). Might be a stupid question, reading the docs http

Re: Ticket #30382 force_insert flag is not passed when saving parents on inherited models

2023-05-18 Thread charettes
I left some notes on the PR but I think the crux of the issue here is that you are trying to change the meaning of Model.save(force_insert=True) from force the insert of the current model to force the insert of the model and all its bases. This is a problem not only for QuerySet.create but like

Ticket #30382 force_insert flag is not passed when saving parents on inherited models

2023-05-18 Thread Akash Sen
*[*Looking for an alternate approach*]* *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

Ticket #30382 force_insert flag is not passed when saving parents on inherited models

2023-05-18 Thread Akash Sen
*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 is