[snowy] Support latest-sync-revision in User API handler.
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Subject: [snowy] Support latest-sync-revision in User API handler.
- Date: Mon, 18 May 2009 02:57:08 -0400 (EDT)
commit f57baf219001d9f138bec5b4e793ed7f3cadffe1
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Sun May 17 20:49:44 2009 -0700
Support latest-sync-revision in User API handler.
It might be better (would reduce queries) to add this field to the User model.
---
api/handlers.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/api/handlers.py b/api/handlers.py
index 11743f6..a1657c0 100644
--- a/api/handlers.py
+++ b/api/handlers.py
@@ -19,6 +19,7 @@ from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.db import transaction
+from django.db.models import Max
from piston.handler import AnonymousBaseHandler, BaseHandler
from piston.utils import rc, HttpStatusCode
@@ -59,6 +60,7 @@ class UserHandler(AnonymousBaseHandler):
'api-ref': reverse('note_api_index', kwargs=reverse_args),
'href': reverse('note_index', kwargs=reverse_args),
},
+ 'latest-sync-revision' : Note.objects.filter(author=user).aggregate(Max('last_sync_rev'))['last_sync_rev__max']
# TODO: friends
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]