Opened 17 years ago
Closed 16 years ago
#5610 closed (fixed)
Useful for dumpdata to be able to use a specific model
Reported by: | David Reynolds | Owned by: | David Reynolds |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | sprintdec01 feature | |
Cc: | david@…, haavikko@…, oliver@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be useful if ./manage.py dumpdata was able to take optional model parameters for dumping a specific models data. For example:
./manage.py dumpdata product.Category
Would output only data related to the Category model in the product application.
Attachments (7)
Change History (23)
comment:1 by , 17 years ago
Cc: | added |
---|
comment:2 by , 17 years ago
Component: | Uncategorized → django-admin.py |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:3 by , 17 years ago
Triage Stage: | Design decision needed → Accepted |
---|
Sounds good to me. It would also integrate nicely with proposal #4656.
comment:4 by , 17 years ago
Owner: | changed from | to
---|
follow-up: 6 comment:5 by , 17 years ago
Has patch: | set |
---|
Patch adds the functionality, not sure how good the patch is.
Also, it has the ability for you to be able to dump overlapping data, which I'm not certain is useful or not. For example if you did:
./manage.py dumpdata product.Category product
You'd get 2 copies of product.Category
I'm sure I can fix this, but just wondered what people's opinions were on whether it needs fixing or not.
comment:6 by , 17 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Replying to DavidReynolds:
I'm sure I can fix this, but just wondered what people's opinions were on whether it needs fixing or not.
Yes, it does :-)
The patch looks essentially ok, except that it needs docs and tests. As for how to fix the problem you describe - I would suggest collecting the serialization candidates as a dictionary {app: [model list]}; if you specify just the app name, the model list is set to None. Each argument you process checks the existing contents of the dictionary - any existing None entry means you don't have to add an individual model entry, and if you process an app but there is already a model list, you can replace the list with None. (I hope that makes some sort of sense)
by , 17 years ago
Attachment: | dumpdata-additions-5610.diff added |
---|
Fixed dumpdata as per discussion and added in tests
by , 17 years ago
Attachment: | dumpdata-additions-5610.2.diff added |
---|
Fixed dumpdata as per discussion and added in tests
comment:7 by , 17 years ago
Keywords: | sprintdec01 added |
---|
Please ignore the second patch, I got my diff the wrong way around. Can someone advise on if the tests are ok?
by , 17 years ago
Attachment: | ukcountieslocalflavor-5523.diff added |
---|
Docs for new features of dumpdata
by , 17 years ago
Attachment: | dumpdata-additions-docs-5610.diff added |
---|
Docs for new features of dumpdata
comment:8 by , 17 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
It's not my day today.
Please ignore the wrong patch I added. The latest patch now has docs and tests in it.
comment:9 by , 17 years ago
Thanks for the very useful patch, this was just the functionality I needed.
Problem: starting R6922, I no longer can apply dumpdata-additions-docs-5610.diff against trunk.
by , 17 years ago
Attachment: | dumpdata-additions-trunk-5610.diff added |
---|
Should now be able to be applied to trunk.
comment:12 by , 17 years ago
Cc: | added |
---|
comment:13 by , 17 years ago
Keywords: | feature added |
---|
by , 16 years ago
Attachment: | dumpdata-addition-r9646.diff added |
---|
Updated to work against latest trunk
comment:15 by , 16 years ago
Cc: | added |
---|
comment:16 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I agree, that could be useful... but I'll push to a design decision. Perhaps bring this up on the django-dev group