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
- Easier chainability with custom QuerySets by bendavis78 2 months, 2 weeks ago
- Generic object_detail view with multiple named URL filters by cotton 5 months, 1 week ago
- sort_by_id_sequence by simon 4 years ago
- Find nearby objects by paulsmith 5 years, 1 month ago
- TaggedManager and TaggedQuerySet with chainable tagged() methods implemented with django-tagging by fish2000 2 years, 3 months ago
Comments