Adds 'author_id' in /lot PATCH
This commit is contained in:
parent
5748a45d2c
commit
c9d4ae9646
|
@ -41,10 +41,10 @@ class LotView(View):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def patch(self, id):
|
def patch(self, id):
|
||||||
patch_schema = self.resource_def.SCHEMA(only=('name', 'description', 'transfer_state', 'receiver_id', 'deposit', 'delivery_note_address', 'devices'), partial=True)
|
patch_schema = self.resource_def.SCHEMA(only=('name', 'description', 'transfer_state', 'receiver_id', 'deposit', 'delivery_note_address', 'devices', 'author_id'), partial=True)
|
||||||
l = request.get_json(schema=patch_schema)
|
l = request.get_json(schema=patch_schema)
|
||||||
lot = Lot.query.filter_by(id=id).one()
|
lot = Lot.query.filter_by(id=id).one()
|
||||||
device_fields = ['transfer_state', 'receiver_id', 'deposit', 'delivery_note_address']
|
device_fields = ['transfer_state', 'receiver_id', 'deposit', 'delivery_note_address', 'author_id']
|
||||||
computers = [x for x in lot.all_devices if isinstance(x, Computer)]
|
computers = [x for x in lot.all_devices if isinstance(x, Computer)]
|
||||||
for key, value in l.items():
|
for key, value in l.items():
|
||||||
setattr(lot, key, value)
|
setattr(lot, key, value)
|
||||||
|
|
Reference in New Issue