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:
@@ -42,7 +42,12 @@ def edit(portfolio_id, task_order_id=None):
|
||||
def update(portfolio_id, task_order_id=None):
|
||||
form_data = {**http_request.form, **http_request.files}
|
||||
|
||||
form = TaskOrderForm(form_data)
|
||||
form = None
|
||||
if task_order_id:
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
form = TaskOrderForm(form_data, obj=task_order)
|
||||
else:
|
||||
form = TaskOrderForm(form_data)
|
||||
|
||||
if form.validate():
|
||||
task_order = None
|
||||
|
Reference in New Issue
Block a user