Standard Upload Done
This commit is contained in:
parent
0ad67210c3
commit
81df22e4d5
|
|
@ -334,14 +334,11 @@ def NCAddStandardFiles(request):
|
||||||
agency = Agency.objects.get(pk=request.GET.get('agencyid'))
|
agency = Agency.objects.get(pk=request.GET.get('agencyid'))
|
||||||
file_to_load = DataFile.objects.get(pk=request.GET.get('fileid'))
|
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!
|
# 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:
|
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))
|
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):
|
if(len(r.text) == 0):
|
||||||
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' angelegt.'})
|
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' angelegt.'})
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue