diff --git a/pandora/user/models.py b/pandora/user/models.py index f89764b0..90371058 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -70,13 +70,16 @@ class SessionData(models.Model): data.save() return data + def get_id(self): + return self.user and ox.to26(self.user.id) or self.session_key + def json(self, keys=None, user=None): j = { 'disabled': False, 'email': '', 'firstseen': self.firstseen, 'ip': self.ip, - 'id': self.user and ox.to26(self.user.id) or self.session_key, + 'id': self.get_id(), 'lastseen': self.lastseen, 'level': 'guest', 'notes': '', diff --git a/pandora/user/views.py b/pandora/user/views.py index 57330918..8e2d58a0 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -515,7 +515,7 @@ Positions if qs.count() > 0: response['data']['position'] = utils.get_positions(ids, [qs[0].itemId])[0] elif 'positions' in data: - ids = [ox.to26(i.id) for i in qs] + ids = [i.get_id() for i in qs] response['data']['positions'] = utils.get_positions(ids, data['positions']) else: response['data']['items'] = qs.count()