Opened 16 years ago
Closed 11 years ago
#11838 closed New feature (wontfix)
Make syncdb understand "initialdata" directory
| Reported by: | Deniz Dogan | Owned by: | Brandon Konkle |
|---|---|---|---|
| Component: | Core (Serialization) | Version: | dev |
| Severity: | Normal | Keywords: | syncdb loaddata initial_data |
| Cc: | brandon.konkle@… | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
In many projects I often find the need to load my data from several separate JSON formatted data dumps. This is because it's easier to manage dumps from different models separately. Unfortunately, syncdb only understands one thing and that is a file named initial_data.json. I think it would be better if syncdb looked for that file, uses it if it finds it, otherwise looks for a directory named initialdata and loads all of the files from that directory.
Attachments (2)
Change History (14)
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
by , 16 years ago
| Attachment: | ticket11838.diff added |
|---|
comment:3 by , 16 years ago
| Has patch: | set |
|---|
I've implemented the feature as Russel described above. My diff includes the changes to the code, tests, and documentation. Also, since this is my first Django contribution, I've added my name to the AUTHORS file. :-) Thanks!
comment:4 by , 16 years ago
The patch is not applying correctly because of a bug in Macport's version of Subversion. I am removing the Macports-installed Subversion and compiling it from source. I'll re-submit the diff when I'm done.
by , 16 years ago
| Attachment: | ticket11838-2.diff added |
|---|
comment:5 by , 16 years ago
comment:6 by , 16 years ago
| Cc: | added |
|---|
comment:7 by , 16 years ago
| Component: | Uncategorized → Serialization |
|---|---|
| milestone: | 1.2 |
comment:8 by , 15 years ago
| Severity: | → Normal |
|---|---|
| Type: | → New feature |
comment:9 by , 15 years ago
| Patch needs improvement: | set |
|---|
The tests would need to be rewritten using unittests since this is now Django's preferred way.
comment:12 by , 11 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
The new migrations framework doesn't load initial data any more.
I can see the value in the idea, but I'd favor something more generic. Rather than making a special case of an 'initialdata' directory, make a directory a valid form for a fixture. That is, the loading sequence for
./manage.py loaddata foowould be something like:This would allow you to split your initial_data fixture over mutliple files as long as you called the fixture directory initial_data, but would also allow any other fixture to follow the same behavior.