JsonResponses raus
This commit is contained in:
parent
2fdf652a42
commit
3aa1566828
|
|
@ -147,13 +147,7 @@ def getICSFileEx(request, code, ag):
|
|||
#try:
|
||||
agency = Agency.objects.get(pk=ag)
|
||||
|
||||
print("AG CODE: " + str(agency.agencycalurl))
|
||||
print("CODE REQUEST: " + str(code))
|
||||
print(str(code) == str(agency.agencycalurl))
|
||||
|
||||
if agency != None:
|
||||
if agency.agencycal_publicstatus == 1:
|
||||
if str(code) == str(agency.agencycalurl):
|
||||
if agency != None and agency.agencycal_publicstatus == 1 and str(code) == str(agency.agencycalurl):
|
||||
c = Calendar()
|
||||
absencedays = Absence.objects.filter(agency=ag).exclude(confirm_status=2)
|
||||
for ab in absencedays:
|
||||
|
|
@ -170,17 +164,11 @@ def getICSFileEx(request, code, ag):
|
|||
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:
|
||||
return JsonResponse({"err" : "AGENCY NOT FOUND"})
|
||||
#realm = ""
|
||||
#response = HttpResponse()
|
||||
#response.status_code = 400
|
||||
#return response
|
||||
realm = ""
|
||||
response = HttpResponse()
|
||||
response.status_code = 400
|
||||
return response
|
||||
#except:
|
||||
# realm = ""
|
||||
# response = HttpResponse()
|
||||
|
|
|
|||
Loading…
Reference in New Issue