Skip to content

Commit

Permalink
Remove safe from JsonResponse
Browse files Browse the repository at this point in the history
According to Django docs[1]:

> If it’s set to False, any object can be passed for serialization
> (otherwise only dict instances are allowed)

As we are using a dict, there's no need for the safe=False.

[1] https://docs.djangoproject.com/en/3.2/ref/request-response/#jsonresponse-objects
  • Loading branch information
cuducos committed Jul 13, 2021
1 parent 7e650cf commit 1ab9737
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion perfil/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


def home(request):
return JsonResponse({"data": "API do Perfil Politico está online."}, safe=False)
return JsonResponse({"data": "API do Perfil Politico está online."})


class CandidateListResource(DjangoResource):
Expand Down

0 comments on commit 1ab9737

Please sign in to comment.