Opened 6 years ago

Closed 5 years ago

#12107 closed (wontfix)

Add a Meta.serialize option to models

Reported by: emulbreh 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:

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

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by emulbreh

comment:1 Changed 6 years ago by anonymous

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset

Changed 6 years ago by emulbreh

with docs

comment:2 Changed 6 years ago by emulbreh

  • Needs documentation unset

comment:3 Changed 5 years ago by russellm

  • Resolution set to wontfix
  • Status changed from new to closed

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