Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: d566211859
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (38 sloc) 1.362 kB
from django.core import serializers
from django.utils import simplejson
from django.http import HttpResponse
from models import Entry
from django.contrib.auth.models import User
def latest(request):
"""
Return a list of the latest entries for all members.
"""
users = User.objects.all()
data = []
for user in users:
try:
entry = user.log_entries.all()[0]
try:
latest_checkin_entry = user.log_entries.filter(on_illutron=True)[0].time.isoformat()
except:
latest_checkin_entry = False
if user.first_name and user.last_name:
name = user.first_name + " " + user.last_name
else:
name = user.username
try:
image = user.get_profile().image.url
except:
image = False
data.append({
'member': name,
'on_illutron': entry.on_illutron,
'latest_checkin_time': latest_checkin_entry,
'image': image
#'last_log_entry': entry.time.isoformat(),
#'latitude': entry.latitude,
#'longitude': entry.longitude,
})
except:
pass
return HttpResponse(simplejson.dumps(data), mimetype='application/json')
Jump to Line
Something went wrong with that request. Please try again.