Snippet List
I often need to dump data from a database to csv. This little snippet should make it easy enough to do without having to worry too much about character encodings, though it does assume you want your csv file to be utf-8 encoded.
Note that this dumps just one table from the database. Trying to dump all the tables in your app will raise an exception.
Sometimes, when you're working on improving one specific aspect of your site, it's easier to browse your code by type than by application. E.g. you want quick access to all admin.py files because you're improving or customizing your admin site across the board and not for a specific app. This little management command adds a shortcuts dir to your project root that contains a bunch of symlinks to your code, organized in subdirs by type of code.
You'll have to put this in `/management/commands/make_shortcuts.py` under an app of your choice. Usage: `python manage.py make_shortcuts`. Don't forget to ignore the /shortcuts directory in your source code management software.
- shortcut
- utility
- organization
This is a general-purpose utility function, but since it uses lazy sequences via itertools, so it should be suitable for use with Querysets.
- python
- utility
- sequence
- itertools
6 snippets posted so far.