summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorroot <root@lalalizard.com>2012-12-21 14:21:15 -0500
committerroot <root@lalalizard.com>2012-12-21 14:21:15 -0500
commit7d424a0c438a6a1e12c6d2913d8f22fa7efc7df6 (patch)
tree49b3aa5c0a460c2dc6692c66104340d4e84eee98 /frontend
parente6c5db3580b09fc7b14a0c1e3d41b419eeec9d13 (diff)
various fixes
Diffstat (limited to 'frontend')
-rw-r--r--frontend/views.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/frontend/views.py b/frontend/views.py
index a645a51..6810dd5 100644
--- a/frontend/views.py
+++ b/frontend/views.py
@@ -80,9 +80,9 @@ def topvideos(request):
tomorrow = today + timedelta(days=1)
yersterday = today - timedelta(days=1)
videos = SJContent.objects.filter(content_type='video')
- top_today = videos.filter(Q(datetime__gt=today) & Q(datetime__lt=tomorrow))[0:ROOM_VIDEO_LOG_SIZE]
- top_yesterday = videos.filter(Q(datetime__gt=yersterday) & Q(datetime__lt=today))[0:ROOM_VIDEO_LOG_SIZE]
- top_alltime = videos[0:ROOM_VIDEO_LOG_SIZE]
+ top_today = videos.filter(Q(datetime__gt=today) & Q(datetime__lt=tomorrow)).annotate(likes=Count('sjlike')).order_by('-likes')[0:ROOM_VIDEO_LOG_SIZE]
+ top_yesterday = videos.filter(Q(datetime__gt=yersterday) & Q(datetime__lt=today)).annotate(likes=Count('sjlike')).order_by('-likes')[0:ROOM_VIDEO_LOG_SIZE]
+ top_alltime = SJContent.objects.filter(content_type='video').annotate(likes=Count('sjlike')).order_by('-likes')[0:ROOM_VIDEO_LOG_SIZE]
response = render_to_response(
'topvideos.html',
@@ -148,7 +148,7 @@ def profile(request, username):
thumbnail = get_thumbnail(userprofile)
topz = SJContent.objects.filter(user__id=userprofile.user.id, content_type='video').annotate(likes=Count('sjlike')).order_by('-likes')[:50]
- likez = SJContent.objects.filter(user__id=userprofile.user.id, content_type='video', sjlike__isnull = False ).order_by('-datetime')[:50]
+ likez = SJContent.objects.filter(content_type='video', sjlike__user_id = userprofile.user.id ).order_by('-datetime')[:50]
vidz = SJContent.objects.filter(user__id=userprofile.user.id, content_type='video').order_by('-datetime')[:50]
profile = [ userprofile.id, userprofile.nickname, userprofile.score, 3, 4, 5, userprofile.bio, json.loads(userprofile.settings_text) ]
@@ -173,6 +173,9 @@ def profile(request, username):
response['Pragma'] = 'no-cache'
return response
+def profile_own(request):
+ return profile(request, request.user.username)
+
def roomlist(request):
recenttime = datetime.fromtimestamp(time.time() - 86400)
@@ -262,7 +265,7 @@ def register(request):
response['Pragma'] = 'no-cache'
return response
-def admin(request):
+def admin(request, roomname):
response = render_to_response(
'admin.html',
{