From ad03e67365269b4388e657b83e46c7416f1cf332 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 7 Nov 2011 16:05:21 +0100 Subject: [PATCH] sort level --- pandora/user/models.py | 4 ++++ pandora/user/views.py | 1 + 2 files changed, 5 insertions(+) diff --git a/pandora/user/models.py b/pandora/user/models.py index 4c32a39f9..7b580ca1a 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -23,6 +23,7 @@ class SessionData(models.Model): firstseen = models.DateTimeField(auto_now_add=True, db_index=True) lastseen = models.DateTimeField(auto_now=True, db_index=True) username = models.CharField(max_length=255, null=True, db_index=True) + level = models.IntegerField(default=0) timesseen = models.IntegerField(default=0) ip = models.CharField(default='', max_length=255) @@ -40,7 +41,10 @@ class SessionData(models.Model): def save(self, *args, **kwargs): if self.user: self.username = self.user.username + self.level = self.user.get_profile().level self.firstseen = self.user.date_joined + else: + self.level = 0 super(SessionData, self).save(*args, **kwargs) @classmethod diff --git a/pandora/user/views.py b/pandora/user/views.py index 39479d031..a560c90a7 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -422,6 +422,7 @@ def order_query(qs, sort): 'useragent': 'useragent', 'username': 'username', 'windowsize': 'windowsize', + 'level': 'level', }.get(e['key'], 'user__profile__%s'%e['key']) if key == 'user__profile__numberoflists': qs = qs.annotate(numberoflists=Sum('user__lists'))