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