Djangosnippets - djangosnippets.org - djangosnippets.org: Latest snippets
General Information:
Latest News:
Model Mixin to Save Only Changed Fields 26 Aug 2013 | 09:18 am
Django 1.5 added the update_fields kwarg to Model.save(), which allows the developer to specify that only certain fields should actually be committed to the database. However, Django provides no way t...
Create a random integer in a template 23 Aug 2013 | 02:40 pm
Create a random integer with given length. For a length of 3 it will be between 100 and 999. For a length of 4 it will be between 1000 and 9999. Use it in a template like:
Dropbox Chooser Form Widget 21 Aug 2013 | 08:28 am
Widget to place a Dropbox Chooser button on a form. Replace data-app-key value with your Dropbox Chooser app key.
Web Development Auckland 16 Aug 2013 | 03:35 pm
Fortune Innovations Auckland is a New Zealand Based Web Development Company. We specialize in Web Development, Application Development and Customized CMS Development. http://auckland.fortuneinnovation...
Logging to rotating files 15 Aug 2013 | 04:59 am
It took me some time to figure out how to set up logging in Django. What I want to do is to log to a pair of rotating files each 1MB in size. What I come up with is this code segment in the settings....
Many 2 Many Admin Ordering with Mysql 13 Aug 2013 | 07:30 am
My Models has a FK to translations and also a many 2 many to categories which also them are translated With this code I concatenate the translation of the categories and allow the changelist to order...
Generic admin action to export data into excel/csv 30 Jul 2013 | 10:40 pm
This is a generic admin action to select and export the data from admin view including the proxy models.
Save Geolocation for an Address based model on save() 22 Jul 2013 | 04:49 pm
This code will work on any model using correct address data in its fields that also require latitude and longitude data to be updated on saving. It uses pythons own default urllib and json, so no nee...
Basic PDF view mixin and utils using reportlab. 19 Jul 2013 | 12:13 pm
Simplified version of the snippet that renders model to PDF http://djangosnippets.org/snippets/2540/ This PDF view mixin for Django Class Based Views. See working project example: https://github.com...
A widget that renders JSON data as separate editable inputs. 17 Jul 2013 | 05:53 am
You can see full examples on the page GitHub