Class ExamplemOdel (Models.Model):
    Some_Headers= Models.JSONFIELD ()
    DEF _Modifying_Method (Self):
        "" This method does not cause SAVE () after calling POP,
        And accordingly, the value is not edited at the level of the base object. "" "
        self.some_headers.pop ("Required_Header")
        Other actions
    Def Calling_Method (Self):
        "" "Method causing a modifying method. It also does not cause the Save () method" "
        Self._Modifying_Method ()
        Other actions

Can the Save () method call serve as a guarantee that the key in the value will not disappear from the database and does the KEYERROR error occur during the next call? Do I need to insure the code, guided by the words "suddenly somewhere will pop up the call to the SAVE method (), which is unknown inside modification methods?

At a minimum, you have already made a mistake by placing a mutable object in Default, which will be common for all created instances of ExampleModel before rebooting data from the base. And so it seems to be the base should not be trimmed without calling the SAVE method (and whether the SAVE method is called -it is visible to you in your code)

andreymal2021-07-21 16:23:35

Wrote purely for example. Even about it somehow did not think. Edited the question. Take this in response, please.

Crazy Theory2021-07-21 17:26:19