Opened 9 years ago

Closed 9 years ago

#25561 closed Bug (invalid)

dumpdata command cannot understand a dotted app name though INSTALLED_APPS allows it.

Reported by: Wade Dare Owned by: nobody
Component: Utilities Version: 1.7
Severity: Normal Keywords: dumpdata
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

python3 manage.py dumpdata 'ers_database.c3rs' > test_mapper.json
CommandError: Unknown model: ers_database.c3rs

c3rs is a submodule of the ers_database module and has its own models.py

Change History (5)

comment:1 by Wade Dare, 9 years ago

also, ers_database has its own models.py.

Database router in use, both models.py utilize the router and use the same app_label. Migrations work.

'python3 manage.py dumpdata ers_database' produces a zero-length file though there is data in the database.

Database type is postgresql

comment:2 by Tim Graham, 9 years ago

I'm not sure this is a supported configuration of models. Can you provide a sample app for better clarity?

Please see #25127 for a documentation request about how to define models in multiple modules which may be relevant.

comment:3 by Wade Dare, 9 years ago

I'll attempt to put together a representative case.

Thanks for the reference link.

comment:4 by Wade Dare, 9 years ago

I was able to reproduce the issue in sample I ginned up, which mimics the same db architecture and module/submodule layout as the system I encountered the problem on. However, in the process of working with my sample, I came to realize that the dumpdata command works with the app_labels of the models and that using

manage.py dumpdata app_label.ModelClassName


(where the model is in the models.py of the submodule) works just fine and that I was doing it wrong on the original system.

When I ran into difficulties I was trying to do a

manage.py dumpdata app_label.subapp_label

which dumpdata reasonably considered to be a class
and

manage.py dumpdata app_label.subapp_label.ModelClassName'

which it considered to be an app

Please close as not a bug.

comment:5 by Wade Dare, 9 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top