Apply 0 Lot : 0-1 Deliverynote relationship
This commit is contained in:
parent
f5b2f3c2f6
commit
de8af45065
|
@ -49,11 +49,10 @@ class Deliverynote(Thing):
|
||||||
lot_id = db.Column(UUID(as_uuid=True),
|
lot_id = db.Column(UUID(as_uuid=True),
|
||||||
db.ForeignKey(Lot.id),
|
db.ForeignKey(Lot.id),
|
||||||
nullable=False)
|
nullable=False)
|
||||||
lots = db.relationship(Lot,
|
lot = db.relationship(Lot,
|
||||||
backref=db.backref('deliverynotes', lazy=True, collection_class=set),
|
backref=db.backref('deliverynote', uselist=False, lazy=True),
|
||||||
lazy=True,
|
lazy=True,
|
||||||
primaryjoin=Lot.id == lot_id,
|
primaryjoin=Lot.id == lot_id)
|
||||||
collection_class=set)
|
|
||||||
|
|
||||||
def __init__(self, document_id: str, deposit: str, date,
|
def __init__(self, document_id: str, deposit: str, date,
|
||||||
supplier_email: str,
|
supplier_email: str,
|
||||||
|
|
|
@ -25,4 +25,4 @@ class Lot(Thing):
|
||||||
owner_address = SanitizedStr(validate=f.validate.Length(max=42))
|
owner_address = SanitizedStr(validate=f.validate.Length(max=42))
|
||||||
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|
||||||
receiver_address = SanitizedStr(validate=f.validate.Length(max=42))
|
receiver_address = SanitizedStr(validate=f.validate.Length(max=42))
|
||||||
deliverynotes = NestedOn(s_deliverynote.Deliverynote, many=True, dump_only=True)
|
deliverynote = NestedOn(s_deliverynote.Deliverynote, dump_only=True)
|
||||||
|
|
Reference in New Issue