Display and overwrite task order uploads correctly.

- Populate the POSTed form with additional data from the existing TO
  model. This way the pdf attachment has to be explicitly overwritten.
- Adjust the frontend so that if there is an existing PDF, it only sends
  a file input back if the user removes the existing PDF.
This commit is contained in:
dandds
2019-06-11 09:58:32 -04:00
parent 49332c5d6e
commit 0e89a55c07
4 changed files with 18 additions and 7 deletions

View File

@@ -145,7 +145,7 @@ def test_task_orders_update_pdf(
def test_task_orders_update_delete_pdf(client, user_session, portfolio, pdf_upload):
user_session(portfolio.owner)
task_order = TaskOrderFactory.create(pdf=pdf_upload)
data = {"number": "0123456789", "pdf": None}
data = {"number": "0123456789", "pdf": ""}
response = client.post(
url_for(
"task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order.id