From 619e7f27e996cfb0684b5955e7d93da3dbf02e5e Mon Sep 17 00:00:00 2001 From: emmdim Date: Tue, 17 Dec 2019 17:16:13 +0100 Subject: [PATCH] Minor updates --- ereuse_devicehub/resources/lot/models.py | 3 +-- ereuse_devicehub/resources/lot/views.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/lot/models.py b/ereuse_devicehub/resources/lot/models.py index db90596a..c0782bf3 100644 --- a/ereuse_devicehub/resources/lot/models.py +++ b/ereuse_devicehub/resources/lot/models.py @@ -73,8 +73,7 @@ class Lot(Thing): transfer_state.comment = TransferState.__doc__ receiver_id = db.Column(CIText(), db.ForeignKey(User.ethereum_address), - nullable=True, - default=lambda: g.user.ethereum_address) + nullable=True) receiver = db.relationship(User, primaryjoin=receiver_id == User.ethereum_address) delivery_note_address = db.Column(CIText(), nullable=True) diff --git a/ereuse_devicehub/resources/lot/views.py b/ereuse_devicehub/resources/lot/views.py index 2e0b7e3e..31b8ae96 100644 --- a/ereuse_devicehub/resources/lot/views.py +++ b/ereuse_devicehub/resources/lot/views.py @@ -40,7 +40,7 @@ class LotView(View): return ret def patch(self, id): - patch_schema = self.resource_def.SCHEMA(only=('name', 'description', 'transfer_state', 'receiver', 'deposit'), partial=True) + patch_schema = self.resource_def.SCHEMA(only=('name', 'description', 'transfer_state', 'receiver_id', 'deposit', 'delivery_note_address'), partial=True) l = request.get_json(schema=patch_schema) lot = Lot.query.filter_by(id=id).one() if lot.transfer_state.name == 'Initial':