user positions

This commit is contained in:
j 2011-11-08 00:00:08 +01:00
parent 1ded5a0cd4
commit 6aec4ff1b1
2 changed files with 5 additions and 2 deletions

View file

@ -70,13 +70,16 @@ class SessionData(models.Model):
data.save() data.save()
return data 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): def json(self, keys=None, user=None):
j = { j = {
'disabled': False, 'disabled': False,
'email': '', 'email': '',
'firstseen': self.firstseen, 'firstseen': self.firstseen,
'ip': self.ip, 'ip': self.ip,
'id': self.user and ox.to26(self.user.id) or self.session_key, 'id': self.get_id(),
'lastseen': self.lastseen, 'lastseen': self.lastseen,
'level': 'guest', 'level': 'guest',
'notes': '', 'notes': '',

View file

@ -515,7 +515,7 @@ Positions
if qs.count() > 0: if qs.count() > 0:
response['data']['position'] = utils.get_positions(ids, [qs[0].itemId])[0] response['data']['position'] = utils.get_positions(ids, [qs[0].itemId])[0]
elif 'positions' in data: 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']) response['data']['positions'] = utils.get_positions(ids, data['positions'])
else: else:
response['data']['items'] = qs.count() response['data']['items'] = qs.count()