1 2 3 4 5 6 7 8 9 | """
Given a list of objects with date_time attributes
that return a datetime, this sorts them in ascending
order. It requires the dateutil package from
http://cheeseshop.python.org/pypi/python-dateutil"""
from dateutil.relativedelta import *
shows.sort(cmp=lambda x,y:relativedelta(x.date_time,y.date_time).minutes)
|
More like this
- Generic object_detail view with multiple named URL filters by cotton 1 year, 5 months ago
- Querying datetime aware objects in your local timezone by jayliew 12 months ago
- Querying on existence of a relationship by ubernostrum 5 years, 9 months ago
- isoutc template filter by japerk 4 years, 1 month ago
- Another means of updating a subset of a model's fields by insin 5 years, 6 months ago
Comments