adding isTemporary lot
This commit is contained in:
parent
6142b89f41
commit
e1348e3809
|
@ -99,6 +99,10 @@ class Lot(Thing):
|
|||
def descendants(self):
|
||||
return self.descendantsq(self.id)
|
||||
|
||||
@property
|
||||
def is_temporary(self):
|
||||
return False if self.trade else True
|
||||
|
||||
@classmethod
|
||||
def descendantsq(cls, id):
|
||||
_id = UUIDLtree.convert(id)
|
||||
|
|
|
@ -26,3 +26,4 @@ class Lot(Thing):
|
|||
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|
||||
receiver_address = SanitizedStr(validate=f.validate.Length(max=42))
|
||||
deliverynote = NestedOn(s_deliverynote.Deliverynote, dump_only=True)
|
||||
is_temporary = f.Boolean(missing=True, data_key='isTemporary')
|
||||
|
|
|
@ -32,6 +32,7 @@ class LotView(View):
|
|||
|
||||
def post(self):
|
||||
l = request.get_json()
|
||||
l.pop('is_temporary', '')
|
||||
lot = Lot(**l)
|
||||
db.session.add(lot)
|
||||
db.session().final_flush()
|
||||
|
|
Reference in New Issue