Adding query to Lot views
This commit is contained in:
parent
a2303498cd
commit
6017476822
|
@ -131,7 +131,8 @@ class DevicesDocumentView(DeviceView):
|
||||||
|
|
||||||
class LotsDocumentView(LotView):
|
class LotsDocumentView(LotView):
|
||||||
def find(self, args: dict):
|
def find(self, args: dict):
|
||||||
return self.generate_lots_csv(Lot.query)
|
query = self.query(args)
|
||||||
|
return self.generate_lots_csv(query)
|
||||||
|
|
||||||
def generate_lots_csv(self, query):
|
def generate_lots_csv(self, query):
|
||||||
"""Get lot query and put information in csv format."""
|
"""Get lot query and put information in csv format."""
|
||||||
|
|
|
@ -94,6 +94,10 @@ class LotView(View):
|
||||||
)
|
)
|
||||||
return jsonify(ret)
|
return jsonify(ret)
|
||||||
|
|
||||||
|
def query(self, args):
|
||||||
|
query = Lot.query.distinct()
|
||||||
|
return query
|
||||||
|
|
||||||
def delete(self, id):
|
def delete(self, id):
|
||||||
lot = Lot.query.filter_by(id=id).one()
|
lot = Lot.query.filter_by(id=id).one()
|
||||||
lot.delete()
|
lot.delete()
|
||||||
|
|
Reference in New Issue