Skip to content

Instantly share code, notes, and snippets.

@benmcnelly
Created November 2, 2011 01:55
Show Gist options
  • Save benmcnelly/1332645 to your computer and use it in GitHub Desktop.
Save benmcnelly/1332645 to your computer and use it in GitHub Desktop.
#mobile views
def m_index(request):
events = Event.objects.all().order_by('start_date')
rs = {}
for event in events:
month = event.start_date.strftime("%B")
if rs.has_key(month):
rs[month].append(event)
else:
rs[month] = []
rs[month].append(event)
rs = sortedDict(rs)
return render_to_response('app/events.html',{'events': rs,},
context_instance=RequestContext(request))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment