Standard Upload Done
This commit is contained in:
parent
0ad67210c3
commit
81df22e4d5
|
|
@ -333,15 +333,12 @@ def NCAddStandardFiles(request):
|
|||
if request.method == "GET":
|
||||
agency = Agency.objects.get(pk=request.GET.get('agencyid'))
|
||||
file_to_load = DataFile.objects.get(pk=request.GET.get('fileid'))
|
||||
|
||||
# TODO: Was geht hier bitte nicht? PUT fehler da keine Dateien gefunden werden können
|
||||
print(file_to_load.file.path)
|
||||
|
||||
# Uplod the file!
|
||||
final_file_path = settings.NEXTCLOUD_URL + "remote.php/dav/files/admin/Agenturdaten_"+ str(agency.pk) + "/Standards Uploadbereich"
|
||||
final_file_path = settings.NEXTCLOUD_URL + "remote.php/dav/files/admin/Agenturdaten_"+ str(agency.pk) + "/Standards Uploadbereich/" + file_to_load.name
|
||||
with open(file_to_load.file.path, 'rb') as f:
|
||||
r = requests.put(final_file_path, data=f, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API))
|
||||
print(r.text)
|
||||
|
||||
if(len(r.text) == 0):
|
||||
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' angelegt.'})
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue