upsi
This commit is contained in:
parent
1fad0664ce
commit
3ddc8e14ef
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
$(document).ready(function(){
|
||||
// FIRST CALL GROUPS, When Groups finished User will call by Groups
|
||||
createAgencyGroups(groupids[0]);
|
||||
//addFiles(files[0]);
|
||||
//createAgencyGroups(groupids[0]);
|
||||
addFiles(files[0]);
|
||||
//DEV
|
||||
//rebuildingStandards(standards[0]);
|
||||
//addGroupFolder();
|
||||
|
|
|
|||
24
api/views.py
24
api/views.py
|
|
@ -353,17 +353,21 @@ def NCAddFiles(request):
|
|||
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'))
|
||||
if(DataFile.objects.filter(pk=request.GET.get('fileid')).exists()):
|
||||
file_to_load = DataFile.objects.get(pk=request.GET.get('fileid'))
|
||||
|
||||
# Uplod the file!
|
||||
final_file_path = settings.NEXTCLOUD_URL + "remote.php/dav/files/vhdadjangoapi_8fjz47epc6/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))
|
||||
|
||||
if(len(r.text) == 0):
|
||||
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' angelegt.'})
|
||||
else:
|
||||
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' konnte nicht angelegt. Bitte manuell prüfen!'})
|
||||
else:
|
||||
return JsonResponse({'status' : True, 'message': 'Datei ID nicht gefunden'})
|
||||
|
||||
# Uplod the file!
|
||||
final_file_path = settings.NEXTCLOUD_URL + "remote.php/dav/files/vhdadjangoapi_8fjz47epc6/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))
|
||||
|
||||
if(len(r.text) == 0):
|
||||
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' angelegt.'})
|
||||
else:
|
||||
return JsonResponse({'status' : True, 'message': 'Datei ' + file_to_load.name + ' konnte nicht angelegt. Bitte manuell prüfen!'})
|
||||
|
||||
return JsonResponse({"status" : "NO AUTH"})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue