8000 fix: some Django antipatterns by jrief · Pull Request #7867 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: some Django antipatterns #7867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix antipattern: use JsonResponse as intended
  • Loading branch information
jrief committed Apr 9, 2024
commit 2e40d243c417d4599df194e5acc32c5840ca96c9
6 changes: 2 additions & 4 deletions cms/utils/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import json

from django.http import HttpResponse
from django.http import JsonResponse
from django.utils.encoding import smart_str

NOT_FOUND_RESPONSE = "NotFound"
Expand All @@ -13,4 +11,4 @@ def jsonify_request(response):
* content: original response content
"""
content = {'status': response.status_code, 'content': smart_str(response.content, response.charset)}
return HttpResponse(json.dumps(content), content_type="application/json")
return JsonResponse(content)
0