Opened 15 years ago
Closed 15 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)
Change History (5)
by , 15 years ago
Attachment: | 12107.model_meta_serialize.diff added |
---|
comment:1 by , 15 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Needs tests: | set |
by , 15 years ago
Attachment: | 12107.model_meta_serialize.1.diff added |
---|
comment:2 by , 15 years ago
Needs documentation: | unset |
---|
comment:3 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → 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.
with docs