if order is None order экземлпяр модели order Order match self match t

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if order is None: # order - экземлпяр модели
order = Order(match=self.match, team=self.team)
order.save()
obj = storage.get(('orders', str(order.id)), []) # key = ':'.join(key)
obj.append({"POST":self.POST,
"ip": self.ip,
"id": order.id,
"match": self.match.id,
"team": self.team.slug,
"user": self.user,
'date': datetime.now()})
storage.set(('orders', str(order.id)), obj)
In [38]: pickle.loads(db['orders:191'])
Out[38]:
[{'POST': <QueryDict: {вырезано}>,
'date': datetime.datetime(2009, 8, 13, 20, 2, 47, 47338),
'id': 196L,
'ip': 'неважно',
'match': 4029,
'team': u'audax_italiano',
'user': u'Spartandr'}]