@celery_app.task(name='froide.foirequest.tasks.move_upload_to_attachment')
def move_upload_to_attachment(att_id, upload_id):
    try:
        att = FoiAttachment.objects.get(pk=att_id)
    except FoiAttachment.DoesNotExist:
        return
    try:
        upload = Upload.objects.get(pk=upload_id)
    except FoiAttachment.DoesNotExist:
        return
    file = upload.get_file()
    if file:
        att.pending = False
        att.file.save(att.name, file, save=True)
    upload.finish()
    upload.delete()
    if att.can_convert_to_pdf():
        convert_attachment_task.delay(att.id)
@celery_app.task(name='froide.foirequest.tasks.move_upload_to_attachment')
def move_upload_to_attachment(att_id, upload_id):
    try:
        att = FoiAttachment.objects.get(pk=att_id)
    except FoiAttachment.DoesNotExist:
        return
    try:
        upload = Upload.objects.get(pk=upload_id)
    except FoiAttachment.DoesNotExist:
        return
    file = upload.get_file()
    if file:
        att.pending = False
        att.file.save(att.name, file, save=True)
    upload.finish()
    upload.delete()
    if att.can_convert_to_pdf():
        convert_attachment_task.delay(att.id)