Skip to main content

django task that clears the content of the django Permission and ContentTypes tables, after an initial migration, to make loaddata work.

Project description

django-clear-tables v0.1.2

This is a simple django-app, registering a task called django_clear_tables.

It will delete the contents of django's Permission and ContentTypes models so you can load data from a fixture without problems. Normally, an initial migrate will create permission and content-type data. If you want to clone data from another instance, to a fresh database, this data will clash with the loaddata command.

Be careful because it can also easily mess up your existing database.

Install it with:

pip install django-clear-tables

Usage is as follows:

Add django_clear_tables to INSTALLED_APPS in your django, then:

# initially setup the database
rm db.sqlite3  # or using mysql, pg, ...
./ migrate
# wipe the initially created data
./ django_clear_tables
# load a fixture from somewhere else
./ loaddata dumpdata-from-another-instance.json

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-clear-tables-0.1.2.tar.gz (2.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page