fixing bugs
This commit is contained in:
parent
0415b7efb9
commit
775cd9a215
|
@ -69,13 +69,17 @@ class Allocate(ActionWithMultipleDevices):
|
|||
description = SanitizedStr(default='', description=m.Action.description.comment)
|
||||
start_time = DateTime(data_key='start_time', description=m.Action.start_time.comment)
|
||||
end_time = DateTime(data_key='end_time', description=m.Action.end_time.comment)
|
||||
code = SanitizedStr(validate=Length(min=1, max=STR_BIG_SIZE),
|
||||
code = SanitizedStr(data_key='Transaction', validate=Length(min=1, max=STR_BIG_SIZE),
|
||||
required=False,
|
||||
description='The code of the agent to assigned.')
|
||||
end_users = Integer(validate=[Range(min=1, error="Value must be greater than 0")],
|
||||
required=True)
|
||||
|
||||
|
||||
class Deallocate(ActionWithMultipleDevices):
|
||||
__doc__ = m.Deallocate.__doc__
|
||||
|
||||
|
||||
class EraseBasic(ActionWithOneDevice):
|
||||
__doc__ = m.EraseBasic.__doc__
|
||||
steps = NestedOn('Step', many=True)
|
||||
|
|
|
@ -12,7 +12,7 @@ class AllocateMix():
|
|||
def post(self):
|
||||
""" Create one res_obj """
|
||||
res_json = request.get_json()
|
||||
res_obj = model(**res_json)
|
||||
res_obj = self.model(**res_json)
|
||||
db.session.add(res_obj)
|
||||
db.session().final_flush()
|
||||
ret = self.schema.jsonify(res_obj)
|
||||
|
@ -21,8 +21,8 @@ class AllocateMix():
|
|||
return ret
|
||||
|
||||
def find(self, args: dict):
|
||||
res_objs = model.query.filter_by(author=g.user) \
|
||||
.order_by(model.created.desc()) \
|
||||
res_objs = self.model.query.filter_by(author=g.user) \
|
||||
.order_by(self.model.created.desc()) \
|
||||
.paginate(per_page=200)
|
||||
return things_response(
|
||||
self.schema.dump(res_objs.items, many=True, nested=0),
|
||||
|
@ -31,9 +31,9 @@ class AllocateMix():
|
|||
)
|
||||
|
||||
|
||||
class AllocateView(AllocateMix):
|
||||
class AllocateView(AllocateMix, View):
|
||||
model = Allocate
|
||||
|
||||
|
||||
class DeallocateView(AllocateMix):
|
||||
class DeallocateView(AllocateMix, View):
|
||||
model = Deallocate
|
||||
|
|
Reference in a new issue