Refactor Query.get()
=> Session.get()
per SQLAlchemy 1.4
This commit is contained in:
parent
81aa0ae109
commit
f611a5a521
38 changed files with 169 additions and 205 deletions
|
@ -241,7 +241,7 @@ class OrderingBatchView(PurchasingBatchView):
|
|||
assert not (batch.executed or batch.complete)
|
||||
|
||||
uuid = data.get('row_uuid')
|
||||
row = self.Session.query(self.model_row_class).get(uuid) if uuid else None
|
||||
row = self.Session.get(self.model_row_class, uuid) if uuid else None
|
||||
if not row:
|
||||
return {'error': "Row not found"}
|
||||
if row.batch is not batch or row.removed:
|
||||
|
@ -401,7 +401,7 @@ class OrderingBatchView(PurchasingBatchView):
|
|||
return {'error': "Invalid value for units ordered: {}".format(units_ordered)}
|
||||
|
||||
uuid = data.get('product_uuid')
|
||||
product = self.Session.query(model.Product).get(uuid) if uuid else None
|
||||
product = self.Session.get(model.Product, uuid) if uuid else None
|
||||
if not product:
|
||||
return {'error': "Product not found"}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue