Make nested depth deeper to include neccessary info for delivery note within a lot

This commit is contained in:
yiorgos marinellis 2020-03-03 20:33:37 +01:00
parent 22e3469129
commit fdd93b0941
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class LotView(View):
def one(self, id: uuid.UUID): def one(self, id: uuid.UUID):
"""Gets one action.""" """Gets one action."""
lot = Lot.query.filter_by(id=id).one() # type: Lot lot = Lot.query.filter_by(id=id).one() # type: Lot
return self.schema.jsonify(lot) return self.schema.jsonify(lot, nested=2)
@teal.cache.cache(datetime.timedelta(minutes=5)) @teal.cache.cache(datetime.timedelta(minutes=5))
def find(self, args: dict): def find(self, args: dict):
@ -77,7 +77,7 @@ class LotView(View):
you can filter. you can filter.
""" """
if args['format'] == LotFormat.UiTree: if args['format'] == LotFormat.UiTree:
lots = self.schema.dump(Lot.query, many=True, nested=1) lots = self.schema.dump(Lot.query, many=True, nested=2)
ret = { ret = {
'items': {l['id']: l for l in lots}, 'items': {l['id']: l for l in lots},
'tree': self.ui_tree(), 'tree': self.ui_tree(),