Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while dumping a single object #45

Closed
mazucci opened this issue Oct 11, 2016 · 3 comments
Closed

Issue while dumping a single object #45

mazucci opened this issue Oct 11, 2016 · 3 comments

Comments

@mazucci
Copy link

mazucci commented Oct 11, 2016

I was trying to get a sample fixture for an object and got the following:

python manage.py dump_object "collector.TwitterData" 492784

/usr/local/lib/python2.7/dist-packages/fixture_magic/management/commands/dump_object.py:9: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
from django.db.models import loading

CommandError: object_class must be provided in the following format: app_name.model_name
Try calling dump_object with --help argument or use the following arguments:
<[--kitchensink | -k] [--natural] [--query] object_class id [id ...]>

I'm using django 1.8 for this project

@davedash
Copy link
Owner

Hi @mazucci ,

I haven't used Django in forever... but let me see if I can debug with you.

I think the app_name.model_name needs to be something like collector.twitter_data.

You can get this by doing something like

TwitterData._meta.label_lower

More info here: https://docs.djangoproject.com/en/1.10/ref/models/options/#label-lower

If this works, let me know and we can close this ticket. I should put this in the docs.

If that doesn't work we can try something else.

-d

@mazucci
Copy link
Author

mazucci commented Oct 12, 2016

Hello,

I tried what you mentioned but the error persists. As I mentioned I am using Django 1.8 in that project and the _meta.label_lower was introduced on 1.9.

I tried on a different project that's using Django 1.9 and got a different one:

mazucci@mazucci:~/migrate$ python manage.py dump_object players.player 5
Unknown command: 'dump_object'
Type 'manage.py help' for usage.

Did include the app in settings in this way:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'fixture_magic',
    'questionnaire',
    'players',
]

However, I figured I could do my own specific dump for that model. Thanks for contributing!

@mazucci mazucci closed this as completed Oct 12, 2016
@rafael-h-ferreira
Copy link

rafael-h-ferreira commented Jul 26, 2017

Hi all,

I had the same problem and every thing changed by commenting the line

args = "<[--kitchensink | -k] [--natural] [--query] object_class id [id ...]>"

on the management/commands/dump_object.py file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants