Opened 15 years ago

Closed 15 years ago

Last modified 9 years ago

#12685 closed (fixed)

Serialized objects' save function does not respect force_insert — at Version 1

Reported by: dcotruta Owned by: nobody
Component: Core (Serialization) Version: 1.1
Severity: Normal Keywords: save, force_insert, force_update
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Russell Keith-Magee)

Given a serialized trivial object, of the type models.Model, which does not override any functions, a deserialized object does not accept the force_insert keyword argument for its save function.

class XYZ(models.Model):
    xyz_creation_date = models.DateTimeField(verbose_name=_("Date Opened"),
                                         blank=False,
                                         auto_now_add=True,
                                         editable=False
                                         )
    
    xyz_is_open = models.BooleanField(default=True)
    
    xyz_last_updated = models.DateTimeField(verbose_name=_("Last Report"),
                                        blank=False,
                                        auto_now=True
                                        )
    
    xyz_synced = models.BooleanField(default=False)

If this model exists on two separate servers, and instances of this object are serialized, passed over the wire, and then deserialized, the save function on the receiving server cannot pass force_insert=True - doing so yields "save() got an unexpected keyword argument 'force_insert'".

Any ideas?

Change History (1)

comment:1 by Russell Keith-Magee, 15 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

Trac is not for asking how-to questions. If you want to know how to do something, ask on django-users.

Note: See TracTickets for help on using tickets.
Back to Top