diff --git a/program/views.py b/program/views.py index 0c125a2205879cf00cc41531f2d83bc56d4220d7..2d64a52c2c6cd44cc2b4dcd266248bc9d0f9148a 100644 --- a/program/views.py +++ b/program/views.py @@ -18,7 +18,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -import json import logging from datetime import date, datetime, time, timedelta from itertools import pairwise @@ -41,7 +40,7 @@ from rest_framework.response import Response from django.conf import settings from django.contrib.auth.models import User from django.db import IntegrityError -from django.http import HttpResponse, HttpResponseRedirect, JsonResponse +from django.http import HttpResponseRedirect, JsonResponse from django.shortcuts import get_object_or_404 from django.utils import timezone from django.utils.translation import gettext as _ @@ -181,10 +180,7 @@ class APIDayScheduleViewSet( schedule.append(entry) - return HttpResponse( - json.dumps(schedule, ensure_ascii=False).encode("utf8"), - content_type="application/json; charset=utf-8", - ) + return JsonResponse(schedule, safe=False) @extend_schema_view( @@ -259,10 +255,7 @@ class APIPlayoutViewSet( if include_virtual and last_timeslot.end < schedule_end: schedule.append(gap_entry(gap_start=last_timeslot.end, gap_end=schedule_end)) - return HttpResponse( - json.dumps(schedule, ensure_ascii=False).encode("utf8"), - content_type="application/json; charset=utf-8", - ) + return JsonResponse(schedule, safe=False) @extend_schema_view(