From 5812ed096461a1d095014de524612013eabb0874 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 31 Oct 2011 18:50:59 +0100 Subject: [PATCH 1/2] 0x does not have external --- pandora/item/management/commands/update_external.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora/item/management/commands/update_external.py b/pandora/item/management/commands/update_external.py index 34959a2e..d58dacf4 100644 --- a/pandora/item/management/commands/update_external.py +++ b/pandora/item/management/commands/update_external.py @@ -28,9 +28,10 @@ class Command(BaseCommand): def handle(self, **options): offset = 0 chunk = options['all'] and 100 or options['items'] - count = pos = models.Item.objects.count() + qs = models.Item.objects.exclude(itemId__startswith='0x') + count = pos = qs.count() while options['all'] and offset <= count or offset < options['items']: - for i in models.Item.objects.all().order_by('modified')[offset:offset+chunk]: + for i in qs.order_by('modified')[offset:offset+chunk]: print pos, i.itemId, i.modified i.update_external() pos -= 1 From 34c2314df4887868d840edb469be457ac6d73ae7 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 31 Oct 2011 23:30:02 +0100 Subject: [PATCH 2/2] findusers --- pandora/user/managers.py | 12 ++++++------ pandora/user/views.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pandora/user/managers.py b/pandora/user/managers.py index e42d9e8e..6a1a0d13 100644 --- a/pandora/user/managers.py +++ b/pandora/user/managers.py @@ -7,10 +7,10 @@ from django.db.models import Q def parseCondition(condition, user): k = condition.get('key', 'name') k = { - 'email': 'user__email', - 'firstseen': 'user__created', - 'lastseen': 'user__last_login', - 'user': 'user__username', + 'firstseen': 'created', + 'lastseen': 'last_login', + 'user': 'username', + 'name': 'username', }.get(k, k) v = condition['value'] op = condition.get('operator') @@ -30,9 +30,9 @@ def parseCondition(condition, user): key = str(key) if exclude: - q = ~Q(**{k: v}) + q = ~Q(**{key: v}) else: - q = Q(**{k: v}) + q = Q(**{key: v}) return q def parseConditions(conditions, operator, user): diff --git a/pandora/user/views.py b/pandora/user/views.py index 14677a46..faf3c246 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -417,6 +417,7 @@ def order_query(qs, sort): 'firstseen': 'date_joined', 'lastseen': 'last_login', 'username': 'username', + 'name': 'username', }.get(e['key'], 'profile__%s'%e['key']) if key == 'profile__numberoflists': qs = qs.annotate(numberoflists=Sum('lists')) @@ -424,7 +425,6 @@ def order_query(qs, sort): order = '%s%s' % (operator, key) order_by.append(order) if order_by: - print order_by #user table does not support this #qs = qs.order_by(*order_by, nulls_last=True) qs = qs.order_by(*order_by)