Archives week 39 of 2011
Sept. 26, 2011 - Oct. 2, 2011
Find Equivalent Timezones with pytz?
Written by
on
in
Snaking.
Ran into a little problem today that requires being able to see what timezones (of the Linux-ish America/Toronto, America/Montreal variety) are equivalent to one another.:
#! /usr/bin/env python
"""Stupid little script to find equivalent timezones"""
import pytz, pprint, pickle, datetime
all_timezones = [pytz.timezone(name) for name in pytz.all_timezones]
def search():
now = datetime.datetime.now()
set = {} ...
Django Model Forms made easier...
Written by
on
in
Snaking.
Django model forms are already easy. How could they be easier?
@decorators.with_X( request, model_class, key, url_field, parameter, required=True )
def my_view( parameter ):
We also use decorators that do x.y lookup on another parameter (i.e. lookup a particular object in the fields of another object based on ids (root_object.field.get( id=...))). Sure, it winds up hitting ...