Fix couch views to not break on single items

A single username or a single log entry was causing an xml->couch
conversion with a dictionary instead of an array. Updated all relevant
views to be able to handle either coming through.
Refactor couch view looping

Switch from enumeration to sequential for loops.
http://stackoverflow.com/questions/3010840/loop-through-array-in-javascript/3010848#3010848
Merge pull request #8 from dimagi/device-log-missing-data

Fix couch views to not break on single items
Fix bug causing filters on reports to not work

Previously the user related selections were using device id's associated
with users which caused some weird issues.
Merge pull request #9 from dimagi/device-log-missing-data

Fix bug causing filters on reports to not work
use setting for stale query
more references
and views
Merge pull request #11 from dimagi/cz

use setting for stale query
sort by date
Merge pull request #12 from dimagi/sort-fix

sort by date
switch to new url tag syntax
Merge branch 'django-1.5' of git://github.com/dimagi/phonelog into django-1.5