Opened 13 years ago

Closed 13 years ago

#14989 closed (duplicate)

Allow serializers to non ovewrite fixtures objects if they are marked as non overridable

Reported by: Manuel Saelices Owned by: nobody
Component: Core (Serialization) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Russell Keith-Magee)

Look at this use case:

  1. The developer creates a new Django project (i.e. with south support).
  2. The developer creates the database schema and load the initial data (including in example a demo home page).
  3. The manager modify home page, and other contents.
  4. The webmaster upgrade the project, and executing migrate command (because south support).
  5. With default Django serializers, all manager changes that exists as fixtures data will be lost.

I know Django docs prevent about that, but It was wonderful you may mark objects as no rewritable, like this:

!xml
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
  <object pk="1" model="fooapp.foomodel" overwrite="no">
    <field type="SlugField" name="slug">welcome</field>
    ...
  </object>
</django-objects>

Look at this implementation as implementation reference.

Change History (4)

comment:1 by Manuel Saelices, 13 years ago

The overwrite="no" mark, Django should not touch this object when loading fixtures if
the object already exists.

comment:2 by Adam Vandenberg, 13 years ago

The "this implementation" link goes to an HTTPS server with an invalid cert, and prompts for trac credentials.

comment:3 by Manuel Saelices, 13 years ago

Sorry, you can remove "s" in https address:

http://dev.merengueproject.org/changeset/2851

comment:4 by Russell Keith-Magee, 13 years ago

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

I'm going to mark this as a duplicate of #14437. It's not strictly the same thing, but it's a very closely related vein -- controlling the 'force_insert/force_update' behavior of fixture insertion.

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