Login

Snippets by skyjur

Snippet List

Management command which helps to find temlate files

If you need to customize many default templates from installed apps, this management command will help you to find those templates and to copy them to desired location. Place this code at: management/commands/templates.py To see a list of installed templates, run: python manage.py templates To copy all templates to specified location: python manage.py templates --copy-to ./templates To copy templates from specified applications only: python manage.py templates admin auth --copy-to ./templates

  • management
  • commands
  • command
Read More

Database cleanup

***About*** I tried to dump data from my database (manage.py dumpdata) and I couldn't do it because of error: User matching query does not exists I found out that my database was filled with garbage: entries those foreigners were deleted. My table's engine is MyISAM so it allows for these lost entries to exist. I had to cleanup my database before I do datadump, so I've written a script which worked fine for me. ***Usage*** Place this script in same directory with your settings.py and run it: `python db_cleanup.py` ***Disclaimer*** Backup your data :)

  • dumpdata
Read More

skyjur has posted 2 snippets.