Search code examples
djangodumpdata

Django 1.7.1 dumpdata progress bar


I have an existing project in django 1.7.1, but from django 1.9.1 a new feature had been introduced in the dumpdata command (--output)

python manage.py dumpdata --output backup.json

On executing this command we can see the progress bar in the terminal(Progress of the dumpdata to a json file). Is there any way to achieve this in django 1.7.1, can we do any additional functionalities in our project?, please help me for this.Thanks in advance.


Solution

  • One possible solution is to add to your application new command which would be a port of django 1.9.1 command - this is the commit to django repo that introduced the change.

    As you can see from the diff the commit modified not only the dumpdata command itself but also serializers' baseclass, so you would have to:

    • create new command (identical to django's one) in your application
    • copy whole serializers module tree to your application
    • update created command to import serializers from your application not django core

    Huh... looks like a lot of forking (copy-pasting) work, that might be a pain in the future. If it's so important for you, I would consider adjusting the project to backward incompatible changes and migrating from django 1.7.1 to 1.9.1.