Allow TOs to be deleted, along with their associated CLINs
This commit is contained in:
@@ -71,3 +71,10 @@ class TaskOrders(BaseDomainClass):
|
||||
by_time_created = sorted(task_orders, key=lambda to: to.time_created)
|
||||
by_status = sorted(by_time_created, key=lambda to: SORT_ORDERING.get(to.status))
|
||||
return by_status
|
||||
|
||||
@classmethod
|
||||
def delete(cls, task_order_id):
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
if task_order:
|
||||
db.session.delete(task_order)
|
||||
db.session.commit()
|
||||
|
||||
@@ -44,7 +44,9 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
signer_dod_id = Column(String)
|
||||
signed_at = Column(DateTime)
|
||||
|
||||
clins = relationship("CLIN", back_populates="task_order")
|
||||
clins = relationship(
|
||||
"CLIN", back_populates="task_order", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
@hybrid_property
|
||||
def pdf(self):
|
||||
|
||||
Reference in New Issue
Block a user