JsonResponses raus
This commit is contained in:
parent
2fdf652a42
commit
3aa1566828
|
|
@ -147,40 +147,28 @@ def getICSFileEx(request, code, ag):
|
||||||
#try:
|
#try:
|
||||||
agency = Agency.objects.get(pk=ag)
|
agency = Agency.objects.get(pk=ag)
|
||||||
|
|
||||||
print("AG CODE: " + str(agency.agencycalurl))
|
if agency != None and agency.agencycal_publicstatus == 1 and str(code) == str(agency.agencycalurl):
|
||||||
print("CODE REQUEST: " + str(code))
|
c = Calendar()
|
||||||
print(str(code) == str(agency.agencycalurl))
|
absencedays = Absence.objects.filter(agency=ag).exclude(confirm_status=2)
|
||||||
|
for ab in absencedays:
|
||||||
|
if ab.start != None and ab.end != None:
|
||||||
|
e = Event()
|
||||||
|
e.name = ab.user.first_name + " " + ab.user.last_name + " abwesend "
|
||||||
|
e.uid = "da-ab-" + str(ab.pk)
|
||||||
|
|
||||||
if agency != None:
|
if ab.start < ab.end:
|
||||||
if agency.agencycal_publicstatus == 1:
|
e.begin = ab.start
|
||||||
if str(code) == str(agency.agencycalurl):
|
e.end = ab.end
|
||||||
c = Calendar()
|
else:
|
||||||
absencedays = Absence.objects.filter(agency=ag).exclude(confirm_status=2)
|
e.begin = ab.start
|
||||||
for ab in absencedays:
|
e.end = ab.start + timedelta(minutes=1)
|
||||||
if ab.start != None and ab.end != None:
|
#e.allday = True
|
||||||
e = Event()
|
c.events.add(e)
|
||||||
e.name = ab.user.first_name + " " + ab.user.last_name + " abwesend "
|
|
||||||
e.uid = "da-ab-" + str(ab.pk)
|
|
||||||
|
|
||||||
if ab.start < ab.end:
|
|
||||||
e.begin = ab.start
|
|
||||||
e.end = ab.end
|
|
||||||
else:
|
|
||||||
e.begin = ab.start
|
|
||||||
e.end = ab.start + timedelta(minutes=1)
|
|
||||||
#e.allday = True
|
|
||||||
c.events.add(e)
|
|
||||||
return HttpResponse(c, content_type='text/calendar')
|
|
||||||
else:
|
|
||||||
return JsonResponse({"err" : "WRONG CODE"})
|
|
||||||
else:
|
|
||||||
return JsonResponse({"err" : "AGENCY NOT PUBLIC"})
|
|
||||||
else:
|
else:
|
||||||
return JsonResponse({"err" : "AGENCY NOT FOUND"})
|
realm = ""
|
||||||
#realm = ""
|
response = HttpResponse()
|
||||||
#response = HttpResponse()
|
response.status_code = 400
|
||||||
#response.status_code = 400
|
return response
|
||||||
#return response
|
|
||||||
#except:
|
#except:
|
||||||
# realm = ""
|
# realm = ""
|
||||||
# response = HttpResponse()
|
# response = HttpResponse()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue