Migration pimp

This commit is contained in:
holger.trampe 2021-08-08 15:44:48 +02:00
parent a54ee18f74
commit 2ed0afcbba
3 changed files with 8 additions and 8 deletions

View File

@ -4,6 +4,7 @@ from django.shortcuts import render, redirect, reverse
from django.urls import reverse_lazy
from django.conf import settings
from django.http import HttpResponseRedirect,HttpResponse, JsonResponse
from requests.api import head
from .models import MainStatistic, MainSalesMonth
from django.contrib.auth.models import User
from chat.models import ChatMessage
@ -733,13 +734,12 @@ class AdmImportFlow(TemplateView):
Erstellt einen Gruppenordner
'''
def createAgGroupFolder(request, agencypk):
print("HI!")
#agency = Agency.objects.get(pk=agencypk)
#data = {
# "gid" : "agencymaingroupid_" + str(agency.pk),
# "aid" : str(agency.pk)
#}
agency = Agency.objects.get(pk=agencypk)
data = {
"gid" : "agencymaingroupid_" + str(agency.pk),
"aid" : str(agency.pk),
}
r = requests.get(settings.NEXTCLOUD_URL + "apps/agency/createagf", auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API))
r = requests.post(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/da_agency/api/v1/creategf", auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), data=data)
print(r.text)
return JsonResponse({'status' : True, 'message': 'Gruppenordner angelegt!'})

View File

@ -271,7 +271,7 @@ def NCAddGroupFolder(request):
"sk'" : settings.NC_SECRETKEY
}
headers = {
'Authorization': 'Bearer ' + request.COOKIES['nc_session_id']
'Authorization': 'Bearer ' + request.user.profile.nc_sid
}
r = requests.post(settings.NEXTCLOUD_URL + "apps/agency/createagf", data=data, headers=headers)
print(r.text)