Skip to main content

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

Project description

django-clear-tables

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 settings.py, then:

# initially setup the database
rm db.sqlite3  # or using mysql, pg, ...
./manage.py migrate
# wipe the initially created data
./manage.py django_clear_tables
# load a fixture from somewhere else
./manage.py 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.1.tar.gz (2.0 kB view details)

Uploaded Source

File details

Details for the file django-clear-tables-0.1.1.tar.gz.

File metadata

  • Download URL: django-clear-tables-0.1.1.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.12

File hashes

Hashes for django-clear-tables-0.1.1.tar.gz
Algorithm Hash digest
SHA256 47a80bec863038b53fe0429f6b43037b59d3daa3d438b6bc4f09e8aa358b992b
MD5 1c0ff8ec4bc06b1725ed70f288f95f32
BLAKE2b-256 a2f7b6271217b2d461ecc0987700736e81e4765d617556292b2a1e8344f62292

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page