I am trying to make a Django view that will give a JSON response with the earliest and latest objects. But, unfortunately, it does not work with this error.
'str' object has no attribute '_meta'
I have another serialization and it works.
Here is the code.
def get_calendar_limits(request):
result = serializers.serialize("json", Session.objects.aggregate(Max('date'), Min('date')), ensure_ascii=False)
return HttpResponse(result, mimetype="application/javascript")
Thank you very much in advance.
source
share