Opened 15 years ago

Closed 14 years ago

#12107 closed (wontfix)

Add a Meta.serialize option to models

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

Description

For unmanaged models it would be nice if dumpdata knew that a particular model should never be serialized.

class MyModel(models.Model):
    class Meta:
        managed = False
        serialize = False

I picked the name serialize for symmetry with Field.serialize, although I'd generally prefer serializable.

Attachments (2)

12107.model_meta_serialize.diff (1.3 KB ) - added by Johannes Dollinger 15 years ago.
12107.model_meta_serialize.1.diff (1.9 KB ) - added by Johannes Dollinger 15 years ago.
with docs

Download all attachments as: .zip

Change History (5)

by Johannes Dollinger, 15 years ago

comment:1 by anonymous, 15 years ago

Has patch: set
Needs documentation: set
Needs tests: set

by Johannes Dollinger, 15 years ago

with docs

comment:2 by Johannes Dollinger, 15 years ago

Needs documentation: unset

comment:3 by Russell Keith-Magee, 14 years ago

Resolution: wontfix
Status: newclosed

I don't like putting attributes like this on Meta - it limits the ability to reuse a model, and acts as a hard constraint on end-user actions. As soon as someone defines an option on the model that says "Don't ever ever", someone will find an edge case where it is needed.

--exclude is already available on dumpdata to exclude specific models from being serialized. IMHO, that's the right approach here.

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