README.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Django-Truncate
  2. ===============
  3. Django-Truncate is a simple library that will add the ability to empty
  4. any given model in any app within your django project, in a more SQL related
  5. words it will **TRUNCATE** the **TABLE** with a simple command::
  6. python manage.py truncate --apps myapp --models model1 model2
  7. Installation
  8. ------------
  9. After you move to your django project main directory follow these simple steps
  10. 1. In your terminal/command line run the following command::
  11. pip install django-truncate
  12. 2. Add "django_truncate" to your **INSTALLED_APPS** in the settings.py file::
  13. INSTALLED_APPS = [
  14. ...
  15. 'django_truncate',
  16. ]
  17. 3. And that's it! you're now ready to use it.
  18. Usage & Options
  19. ---------------
  20. There is two simple options that will make it easier for you to truncate your tables:
  21. 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::
  22. python manage.py truncate --apps appone apptwo
  23. 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::
  24. python manage.py truncate --apps appone --models Model3
  25. **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
  26. Remember you can always see the instructions by running::
  27. python manage.py truncate -h
  28. Compatibility
  29. -------------
  30. 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).
  31. 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
  32. License
  33. -------
  34. This project is under the BSD License.