Skip to content

Commit 98b1dcd

Browse files
authored
Merge pull request #33 from Quazer/master
Change default Content-Type value via Django settings
2 parents ce94080 + e677d7f commit 98b1dcd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ kwarg**, such as ujson, set the ``cls`` option to ``None``::
244244
'cls': None,
245245
}
246246

247+
Default value of content-type is 'application/json'. You can change it vie the
248+
``JSON_DEFAULT_CONTENT_TYPE`` Django settings. For example, to add
249+
charset::
250+
251+
JSON_DEFAULT_CONTENT_TYPE = 'application/json; charset=utf-8'
252+
247253

248254
Atomic Requests
249255
===============

jsonview/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .exceptions import BadRequest
1818

1919
json = import_module(getattr(settings, 'JSON_MODULE', 'json'))
20-
JSON = 'application/json'
20+
JSON = getattr(settings, 'JSON_DEFAULT_CONTENT_TYPE', 'application/json')
2121
logger = logging.getLogger('django.request')
2222

2323

0 commit comments

Comments
 (0)