django-smuggler is a pluggable application for the Django web framework that help you import/export fixtures via the automatically-generated admin interface.
Installing & Setup
Smuggler is in the Python Package Index (PyPI) and you can easily install the latest stable version of it using the tools pip or easy_install. Try:
pip install django-smuggler
or:
easy_install django-smuggler
Alternatively, you can install Smuggler from source code running the follow command on directory that contains the file setup.py:
python setup.py install
After installation you need configure your project to recognizes the Smuggler application adding 'smuggler' to your INSTALLED_APPS setting and setup the project URLConf like follow:
urlpatterns = patterns('',
# ...
(r'^admin/', include('smuggler.urls')), # put it before admin url patterns
(r'^admin/', include(admin.site.urls)),
)
Then try access these urls:
* /admin/import/, to upload files to be imported;
* /admin/export/, to download data from whole project;
* /admin/APP_LABEL/export/, to download data from a app;
* /admin/APP_LABEL/MODEL_LABEL/export/, to download data from a model;
If you can access the URLs above, the application was setup correctly. Note that these URLs are accessible only by superusers.
Smuggler also provides a template to show buttons for import and export data on change list page (change_list.html). You can setup the ModelAdmin you are interested like follow:
class ExampleAdmin(admin.ModelAdmin):
change_list_template = 'smuggler/change_list.html'
...
Note: on directory "etc/sample_templates/" you have some template examples to put Smuggler's buttons on app indexes and admin index page.
Settings
Smuggler has the following settings available. You can set them in your settings.py. If you doesn't set them it will assume the default values:
SMUGGLER_FORMAT
Format for exported files. 'json' and 'xml' are supported. Default: 'json'.
SMUGGLER_INDENT
Indentation for exported files. Default: 4.
SMUGGLER_FIXTURE_DIR
To be used with signal smuggler.signals.save_data_on_filesystem. Default: None.
Product's homepage
Requirements:
· Python
· Django
What's New in This Release: [ read full changelog ]
· Django 1.5+ support;
· Added German translation;
· Added some tests.