Opened 9 years ago

Closed 8 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: UI/UX:


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 9 years ago.
12107.model_meta_serialize.1.diff (1.9 KB) - added by Johannes Dollinger 9 years ago.
with docs

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Johannes Dollinger

comment:1 Changed 9 years ago by anonymous

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

Changed 9 years ago by Johannes Dollinger

with docs

comment:2 Changed 9 years ago by Johannes Dollinger

Needs documentation: unset

comment:3 Changed 8 years ago by Russell Keith-Magee

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