Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KhaledElAnsari/django-truncate
A simple library to help you truncate your tables with one simple command
https://github.com/KhaledElAnsari/django-truncate
cli database django orm python truncate
Last synced: about 2 months ago
JSON representation
A simple library to help you truncate your tables with one simple command
- Host: GitHub
- URL: https://github.com/KhaledElAnsari/django-truncate
- Owner: KhaledElAnsari
- License: bsd-2-clause
- Created: 2016-04-24T11:06:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-01T22:30:08.000Z (about 3 years ago)
- Last Synced: 2024-04-29T23:14:27.769Z (8 months ago)
- Topics: cli, database, django, orm, python, truncate
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-jordan - Django Truncate - A simple library to help you truncate your tables with one simple command Edit (Python / Gists)
README
Django-Truncate
===============Django-Truncate is a simple library that will add the ability to empty
any given model in any app within your django project, in a more SQL related
words it will **TRUNCATE** the **TABLE** with a simple command::python manage.py truncate --apps myapp --models model1 model2
Installation
------------After you move to your django project main directory follow these simple steps
1. In your terminal/command line run the following command::
pip install django-truncate
2. Add "django_truncate" to your **INSTALLED_APPS** in the settings.py file::
INSTALLED_APPS = [
...
'django_truncate',
]3. And that's it! you're now ready to use it.
Usage & Options
---------------There is two simple options that will make it easier for you to truncate your tables:
1. **--apps**: This command will take the name of the apps you want truncate it's data, by default it will truncate all the tables::
python manage.py truncate --apps appone apptwo
2. **--models**: After you enter the app name enter the Model(s) name(s) If you don't want to truncate all of the tables::
python manage.py truncate --apps appone --models Model3
**Note**: if you don't write the name of the app the truncate will stop and you'll see an error message in the terminal
Remember you can always see the instructions by running::
python manage.py truncate -h
Compatibility
-------------This project works with Django 1.7, 1.8 and 1.9 using Python 2 (2.7) or Python 3 (3.4 and 3.5).
For the moment this project is using the Django ORM so django-truncate will work with all of the supported Databases by the Django ORM
License
-------This project is under the BSD License.