diff --git a/README.rst b/README.rst index b86f1f5..1618787 100644 --- a/README.rst +++ b/README.rst @@ -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 =============== diff --git a/jsonview/decorators.py b/jsonview/decorators.py index 8169c82..b436a10 100644 --- a/jsonview/decorators.py +++ b/jsonview/decorators.py @@ -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')