Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22580 closed Uncategorized (invalid)

dumpdata don't work with sub app

Reported by: Fabio Caritas Barrionuevo da Luz <bnafta@…> Owned by: nobody
Component: Core (Management commands) Version: 1.6
Severity: Normal Keywords: dumpdata management commands subapp
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use django-allauth. The django-allauth has a structure of sub apps.
I need to export data from some of the sub apps, although Django support the sub apps, dumpdata command does not have support to this feature

I have the following structure of directories:

django_project:

manage.py
test_dumpdata_subapp:

init.py
settings.py
...

normalapp:

init.py
models.py
...
subapp:

init.py
models.py
...
submodule:

init.py
anothersubapp:

init.py
models.py
...

On settings.py file:

INSTALLED_APPS = (

...
'normalapp',
'normalapp.subapp',
'normalapp.subapp.submodule.anothersubapp',

)

syncdb works perfectly, but try:

python manage.py dumpdata normalapp normalapp.subapp normalapp.subapp.submodule.anothersubapp

results in this:
CommandError: Unknown model: normalapp.subapp

My test project is attached or can be viewed on github: https://github.com/luzfcb/test_dumpdata_subapp

Attachments (1)

test_dumpdata_subapp.tar.gz (46.1 KB ) - added by Fabio Caritas Barrionuevo da Luz <bnafta@…> 11 years ago.
test project to Ticket 22580

Download all attachments as: .zip

Change History (4)

by Fabio Caritas Barrionuevo da Luz <bnafta@…>, 11 years ago

Attachment: test_dumpdata_subapp.tar.gz added

test project to Ticket 22580

comment:1 by Carl Meyer, 11 years ago

Resolution: invalid
Status: newclosed

The app-label for a "subapp" (for any app, really) is just the leaf package name, not the full dotted import path. So you should be running python manage.py dumpdata normalapp subapp anothersubapp.

comment:2 by Fabio Caritas Barrionuevo da Luz <bnafta@…>, 11 years ago

Thank's.
I'm not speaking english language, use google translator for almost everything (I'm still learning). So it was not very clear to me.
It is possible to include an explicit note about it in the documentation and/or help of the dumpdata command?

comment:3 by Carl Meyer, 11 years ago

Many management commands accept app labels, so it doesn't make sense to document this specifically for dumpdata. It seems like the 1.6 docs don't include a clear definition of "app label" (that I can find); however, this has already been addressed for 1.7 in https://docs.djangoproject.com/en/dev/ref/applications/

Note: See TracTickets for help on using tickets.
Back to Top