Skip to content

Commit

Permalink
Change default Content-Type value via Django settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Quazer committed Oct 23, 2016
1 parent ce94080 commit e677d7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.rst
Expand Up @@ -244,6 +244,12 @@ kwarg**, such as ujson, set the ``cls`` option to ``None``::
'cls': None,
}

Default value of content-type is 'application/json'. You can change it vie the
``JSON_DEFAULT_CONTENT_TYPE`` Django settings. For example, to add
charset::

JSON_DEFAULT_CONTENT_TYPE = 'application/json; charset=utf-8'


Atomic Requests
===============
Expand Down
2 changes: 1 addition & 1 deletion jsonview/decorators.py
Expand Up @@ -17,7 +17,7 @@
from .exceptions import BadRequest

json = import_module(getattr(settings, 'JSON_MODULE', 'json'))
JSON = 'application/json'
JSON = getattr(settings, 'JSON_DEFAULT_CONTENT_TYPE', 'application/json')
logger = logging.getLogger('django.request')


Expand Down

0 comments on commit e677d7f

Please sign in to comment.