-
Recent Posts
Github badge
StackOverflow badge
How to read this blog
This blog should be read like all other specifications. First, it should be read cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be read by picking random sections from the contents list and following all the cross-references.Promote JS
Tag Archives: snippet
Django random object manager
Several times in the past I needed to fetch a list of random objects. And Today I decided to make a Mixin class to add a get_random() method to my managers: # -*- coding: utf-8 -*- from random import sample … Continue reading
Add ‘error’ class to widgets with errors in Django Forms
Many times UI requires us to style differently widgets that have errors in a field instead or next to an error message. Django provides a nifty .errors attribute to tell if a field of form has errors but you can’t … Continue reading
Django cheap pages
Sometimes I end up using Django for the wrong thing, just to dispatch pages and put all my content in the templates. Flatpages are too flat and other DB based content tools are too complex. I just want to use … Continue reading
