Skip to content

Commit

Permalink
Is github down?
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan committed Oct 9, 2011
1 parent 173272f commit f04a45f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions apps/log/views.py
@@ -1,18 +1,20 @@
from pprint import pprint
from django.core import serializers
from django.shortcuts import get_object_or_404
from django.utils import simplejson
from django.http import HttpResponse
from django.contrib.auth.models import User


def member(request, id):

user = User.objects.get(id=id)
user = get_object_or_404(User, id=id)

log_entries = user.log_entries.all()[:10]
try:
log_entries = user.log_entries.all()[:10]
log_entries[0]
except:
return HttpResponse("No activity yet.")
return HttpResponse("No activity yet")

if user.first_name and user.last_name:
name = user.first_name + " " + user.last_name
Expand All @@ -21,13 +23,13 @@ def member(request, id):

try:
latest_checkin_entry = user.log_entries.filter(on_illutron=True)[0].time.isoformat()
except:
except IndexError:
latest_checkin_entry = None

try:
image = user.get_profile().image.url
except:
image = False
image = None

log_list = []
for log in log_entries:
Expand All @@ -54,5 +56,5 @@ def member_list(request):
Return a list of all members.
"""

data = simplejson.dumps(list(User.objects.all().values('id', 'username', 'first_name', 'last_name')))
data = simplejson.dumps(list(User.objects.all().values('id', 'username',)))
return HttpResponse(data, mimetype='application/json')

0 comments on commit f04a45f

Please sign in to comment.