2020-06-17T00:19:24 Created temporary directory: /tmp/pip-ephem-wheel-cache-ut9ai3ti 2020-06-17T00:19:24 Created temporary directory: /tmp/pip-req-tracker-h1km682p 2020-06-17T00:19:24 Created requirements tracker '/tmp/pip-req-tracker-h1km682p' 2020-06-17T00:19:24 Created temporary directory: /tmp/pip-wheel-5bj0ecb8 2020-06-17T00:19:24 Collecting djangorestframework-camel-case==1.2.0 2020-06-17T00:19:24 1 location(s) to search for versions of djangorestframework-camel-case: 2020-06-17T00:19:24 * https://pypi.org/simple/djangorestframework-camel-case/ 2020-06-17T00:19:24 Getting page https://pypi.org/simple/djangorestframework-camel-case/ 2020-06-17T00:19:24 Analyzing links from page https://pypi.org/simple/djangorestframework-camel-case/ 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/5b/7c/4bb71b8d835b7a9d6780b736027edc3879b8273bf05741f973a9cea6438e/djangorestframework-camel-case-0.1.0.tar.gz#sha256=3dad9de83a6921f125c5e235751309aede57b3137b6316d617d09eb67443fd99 (from https://pypi.org/simple/djangorestframework-camel-case/), version: 0.1.0 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/8e/8a/691a84e944495126379eb3462775acb97852dcb6f0aa568e7b0eab9ad377/djangorestframework-camel-case-0.1.1.tar.gz#sha256=9d63e4681861706fa4ee0cdd6e3149cf0fb0482498978134b0da7dcba98db6ef (from https://pypi.org/simple/djangorestframework-camel-case/), version: 0.1.1 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/48/0e/04eba902fa61dfedd769757b7124ef273e799a781a6a5f61ada5eba9769f/djangorestframework-camel-case-0.1.2.tar.gz#sha256=7a90e217160a549d09c38b85a397a4d89cb67446374eebdd81ad49347eaa0a92 (from https://pypi.org/simple/djangorestframework-camel-case/), version: 0.1.2 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/d3/a3/0f556e636436859508d655e59755cba657bff58f975534141fc5c8052a9d/djangorestframework-camel-case-0.1.3.tar.gz#sha256=a6a0d41d12b0f9dd982b7858fdada06a311d5da95cc5380c85890ffd5cc01b8b (from https://pypi.org/simple/djangorestframework-camel-case/), version: 0.1.3 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/06/e0/e7b0d8371d20b8d0b6ef7490951b8bb9a392fdf250c35d596ae6842a3db4/djangorestframework-camel-case-0.2.0.tar.gz#sha256=989c5c2d0324069fc1ecea4a5cb8913749d5f2f3c507b38977913ff1b76a719e (from https://pypi.org/simple/djangorestframework-camel-case/), version: 0.2.0 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/b1/f6/2873ce51b0bdb106865afa2a07821f9e808988e5d4f38b1be18473c2f1df/djangorestframework-camel-case-1.0b1.tar.gz#sha256=277a4420789ce2a3535dbbacb4f9e95563bd49766ba0068ed06d46d8577ff212 (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.0b1 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/ab/0e/e94b0714945228d21ad8e814267cabeeca45d07cb4abcf945f07e21f523f/djangorestframework-camel-case-1.0b2.tar.gz#sha256=da0a8d1db8e54cc6fa39226543fbd7f7f6fc534290c2943134de15a627a0288b (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.0b2 2020-06-17T00:19:24 Skipping link https://files.pythonhosted.org/packages/f8/7c/d0b70a927f6fe2f364bad2dc65233c644a6b0ce73315e7782999aa3593a7/djangorestframework_camel_case-1.0b2-py2-none-any.whl#sha256=ac442a20b1811bcda24e68f220e7e4a8e37273be200729118e83b5933a284f1c (from https://pypi.org/simple/djangorestframework-camel-case/); it is not compatible with this Python 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/52/c7/c33cf695e2c69fed8f740eaffd7f6cbb43e081bed9481866e0be301cb61e/djangorestframework-camel-case-1.0.0.tar.gz#sha256=55a5ef1b8603b91baec47357a9465b1c1ac9327a1f152c7e5532f77c94bdfe7c (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.0.0 2020-06-17T00:19:24 Skipping link https://files.pythonhosted.org/packages/b9/a1/05252bf489119e0442d8de5f72c90d4e49c5288e2139ef1df19f9e34f832/djangorestframework_camel_case-1.0.0-py2-none-any.whl#sha256=7526d48b5ce558f4eba38bcff7da18ee5f0eaf88db39642f2743ef200f7f6609 (from https://pypi.org/simple/djangorestframework-camel-case/); it is not compatible with this Python 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/e3/00/a999796be29c1c33b690f3f71599aaec994a13cb105659a9a66b0ca494ff/djangorestframework-camel-case-1.0.1.tar.gz#sha256=5e9764e3aa507f25747eddad22234da0c00c981d44fa8335e490cd9a0a6bdf5f (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.0.1 2020-06-17T00:19:24 Skipping link https://files.pythonhosted.org/packages/36/09/dcd36c58cfa8b57e402229b985e85c82407e49a53d61ad7a90d436d63461/djangorestframework_camel_case-1.0.1-py2-none-any.whl#sha256=5aa2bb693b808a5541f392ae6bb83e5ec78a75be9fb71798b88d5a98908e8f9d (from https://pypi.org/simple/djangorestframework-camel-case/); it is not compatible with this Python 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/e7/e6/690fbb9328067319e92c0ddb19082e057fe0a2fcadbd5344c44c51b12029/djangorestframework-camel-case-1.0.2.tar.gz#sha256=d1908786436583f19a31292fe94151d9d9120b4067cb028ce5fc3d85efd0f270 (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.0.2 2020-06-17T00:19:24 Skipping link https://files.pythonhosted.org/packages/4c/8b/d1166038f0d456960e8f1e7199a024d44f89bdbc9e7a119850b50f7db991/djangorestframework_camel_case-1.0.2-py2-none-any.whl#sha256=f41bc48406d53b569440d190d37ab56e195c5a82a149ce9a05d4167cb48b3f07 (from https://pypi.org/simple/djangorestframework-camel-case/); it is not compatible with this Python 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/38/37/c1fbb6e3a6dc60f525c72b5a494812cb720bb710ccb3181d26729285b2c4/djangorestframework-camel-case-1.0.3.tar.gz#sha256=5b957f9cf16730f153a0ab4add9ff17fb41b7fceaa7edad29b0536b515bffd16 (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.0.3 2020-06-17T00:19:24 Skipping link https://files.pythonhosted.org/packages/b1/2c/72a726b6b247b8ee536061cad6df0b77b32f7789bac1e2551ba579973416/djangorestframework_camel_case-1.0.3-py2-none-any.whl#sha256=4bb2e41fb8a5d3745e20c5ee0842ebc6f6bac602b3286c3dd913b01760a2abb0 (from https://pypi.org/simple/djangorestframework-camel-case/); it is not compatible with this Python 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/dc/6d/8b76e80b825f03bde31dad2ea4d6c6ee0d2e608c8b2e6c0416e291a24238/djangorestframework-camel-case-1.1.0.tar.gz#sha256=9a9403c44d14f0d1352f3bbce3a7d0ba71abd1d3bf2aaa8a03afef600cee511d (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.1.0 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/76/24/1e6bac6ea6ba3ff4ad40134d16a0658b63974ca44f4e3061a349fa3f8468/djangorestframework_camel_case-1.1.0-py3-none-any.whl#sha256=6e95f057cc9738f8715617b111639ca13a3c20de6e80f201a999184eaa9314aa (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.1.0 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/61/bd/6834798850df97742f2d773b28e7c7452e79f44f437990e49364a3d6afb1/djangorestframework-camel-case-1.1.1.tar.gz#sha256=3fb06663a8e1acf84e59ed1219ce7d33957801e2acd951c273e6389efd4b0c31 (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.1.1 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/15/67/561fda9bd35e46bbba5e14502ce1664742d91feb44da291b0e8f4150b0d3/djangorestframework_camel_case-1.1.1-py3-none-any.whl#sha256=bcc831992b724ee634440eb3837d2a48f9af443e0d1280b3f9e018eb514ac9ed (from https://pypi.org/simple/djangorestframework-camel-case/), version: 1.1.1 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/ae/9a/6f51c5bd70293434b96682fdd8515e5e435fef95cda942bb41661c6c4b15/djangorestframework-camel-case-1.1.2.tar.gz#sha256=9eba4a2f959e1e46b7d0f6136baf950552b2a4a695d4bb3cfb0c37be25294574 (from https://pypi.org/simple/djangorestframework-camel-case/) (requires-python:>=3.5), version: 1.1.2 2020-06-17T00:19:24 Found link https://files.pythonhosted.org/packages/74/f8/abbf5e903f4b946542c74e193adc7aa6121d06887d7ac5f87664935e8554/djangorestframework-camel-case-1.2.0.tar.gz#sha256=9714d43fba5bb654057c29501649684d3d9f11a92319ae417fd4d65e80d1159d (from https://pypi.org/simple/djangorestframework-camel-case/) (requires-python:>=3.5), version: 1.2.0 2020-06-17T00:19:24 Using version 1.2.0 (newest of versions: 1.2.0) 2020-06-17T00:19:24 Created temporary directory: /tmp/pip-unpack-qxlm933_ 2020-06-17T00:19:25 Downloading https://files.pythonhosted.org/packages/74/f8/abbf5e903f4b946542c74e193adc7aa6121d06887d7ac5f87664935e8554/djangorestframework-camel-case-1.2.0.tar.gz 2020-06-17T00:19:25 Downloading from URL https://files.pythonhosted.org/packages/74/f8/abbf5e903f4b946542c74e193adc7aa6121d06887d7ac5f87664935e8554/djangorestframework-camel-case-1.2.0.tar.gz#sha256=9714d43fba5bb654057c29501649684d3d9f11a92319ae417fd4d65e80d1159d (from https://pypi.org/simple/djangorestframework-camel-case/) (requires-python:>=3.5) 2020-06-17T00:19:25 Added djangorestframework-camel-case==1.2.0 from https://files.pythonhosted.org/packages/74/f8/abbf5e903f4b946542c74e193adc7aa6121d06887d7ac5f87664935e8554/djangorestframework-camel-case-1.2.0.tar.gz#sha256=9714d43fba5bb654057c29501649684d3d9f11a92319ae417fd4d65e80d1159d to build tracker '/tmp/pip-req-tracker-h1km682p' 2020-06-17T00:19:25 Running setup.py (path:/tmp/pip-wheel-5bj0ecb8/djangorestframework-camel-case/setup.py) egg_info for package djangorestframework-camel-case 2020-06-17T00:19:25 Running command python setup.py egg_info 2020-06-17T00:19:27 ==================================== 2020-06-17T00:19:27 Django REST Framework JSON CamelCase 2020-06-17T00:19:27 ==================================== 2020-06-17T00:19:27 .. image:: https://travis-ci.org/vbabiy/djangorestframework-camel-case.png?branch=master 2020-06-17T00:19:27 :target: https://travis-ci.org/vbabiy/djangorestframework-camel-case 2020-06-17T00:19:27 .. image:: https://badge.fury.io/py/djangorestframework-camel-case.svg 2020-06-17T00:19:27 :target: https://badge.fury.io/py/djangorestframework-camel-case 2020-06-17T00:19:27 Camel case JSON support for Django REST framework. 2020-06-17T00:19:27 ============ 2020-06-17T00:19:27 Installation 2020-06-17T00:19:27 ============ 2020-06-17T00:19:27 At the command line:: 2020-06-17T00:19:27 $ pip install djangorestframework-camel-case 2020-06-17T00:19:27 Add the render and parser to your django settings file. 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 REST_FRAMEWORK = { 2020-06-17T00:19:27 'DEFAULT_RENDERER_CLASSES': ( 2020-06-17T00:19:27 'djangorestframework_camel_case.render.CamelCaseJSONRenderer', 2020-06-17T00:19:27 'djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer', 2020-06-17T00:19:27 # Any other renders 2020-06-17T00:19:27 ), 2020-06-17T00:19:27 'DEFAULT_PARSER_CLASSES': ( 2020-06-17T00:19:27 # If you use MultiPartFormParser or FormParser, we also have a camel case version 2020-06-17T00:19:27 'djangorestframework_camel_case.parser.CamelCaseFormParser', 2020-06-17T00:19:27 'djangorestframework_camel_case.parser.CamelCaseMultiPartParser', 2020-06-17T00:19:27 'djangorestframework_camel_case.parser.CamelCaseJSONParser', 2020-06-17T00:19:27 # Any other parsers 2020-06-17T00:19:27 ), 2020-06-17T00:19:27 } 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 ================= 2020-06-17T00:19:27 Swapping Renderer 2020-06-17T00:19:27 ================= 2020-06-17T00:19:27 By default the package uses `rest_framework.renderers.JSONRenderer`. If you want 2020-06-17T00:19:27 to use another renderer (the only possible alternative is 2020-06-17T00:19:27 `rest_framework.renderers.UnicodeJSONRenderer`, only available in DRF < 3.0), you must specify it in your django 2020-06-17T00:19:27 settings file. 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 JSON_CAMEL_CASE = { 2020-06-17T00:19:27 'RENDERER_CLASS': 'rest_framework.renderers.UnicodeJSONRenderer' 2020-06-17T00:19:27 } 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 ===================== 2020-06-17T00:19:27 Underscoreize Options 2020-06-17T00:19:27 ===================== 2020-06-17T00:19:27 **No Underscore Before Number** 2020-06-17T00:19:27 As raised in `this comment `_ 2020-06-17T00:19:27 there are two conventions of snake case. 2020-06-17T00:19:27 .. code-block:: text 2020-06-17T00:19:27 # Case 1 (Package default) 2020-06-17T00:19:27 v2Counter -> v_2_counter 2020-06-17T00:19:27 fooBar2 -> foo_bar_2 2020-06-17T00:19:27 # Case 2 2020-06-17T00:19:27 v2Counter -> v2_counter 2020-06-17T00:19:27 fooBar2 -> foo_bar2 2020-06-17T00:19:27 By default, the package uses the first case. To use the second case, specify it in your django settings file. 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 REST_FRAMEWORK = { 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 'JSON_UNDERSCOREIZE': { 2020-06-17T00:19:27 'no_underscore_before_number': True, 2020-06-17T00:19:27 }, 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 } 2020-06-17T00:19:27 Alternatively, you can change this behavior on a class level by setting `json_underscoreize`: 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 from djangorestframework_camel_case.parser import CamelCaseJSONParser 2020-06-17T00:19:27 from rest_framework.generics import CreateAPIView 2020-06-17T00:19:27 class NoUnderscoreBeforeNumberCamelCaseJSONParser(CamelCaseJSONParser): 2020-06-17T00:19:27 json_underscoreize = {'no_underscore_before_number': True} 2020-06-17T00:19:27 class MyView(CreateAPIView): 2020-06-17T00:19:27 queryset = MyModel.objects.all() 2020-06-17T00:19:27 serializer_class = MySerializer 2020-06-17T00:19:27 parser_classes = (NoUnderscoreBeforeNumberCamelCaseJSONParser,) 2020-06-17T00:19:27 ============= 2020-06-17T00:19:27 Ignore Fields 2020-06-17T00:19:27 ============= 2020-06-17T00:19:27 You can also specify fields which should not have their data changed. 2020-06-17T00:19:27 The specified field(s) would still have their name change, but there would be no recursion. 2020-06-17T00:19:27 For example: 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 data = {"my_key": {"do_not_change": 1}} 2020-06-17T00:19:27 Would become: 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 {"myKey": {"doNotChange": 1}} 2020-06-17T00:19:27 However, if you set in your settings: 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 REST_FRAMEWORK = { 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 "JSON_UNDERSCOREIZE": { 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 "ignore_fields": ("my_key",), 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 }, 2020-06-17T00:19:27 # ... 2020-06-17T00:19:27 } 2020-06-17T00:19:27 The `my_key` field would not have its data changed: 2020-06-17T00:19:27 .. code-block:: python 2020-06-17T00:19:27 {"myKey": {"do_not_change": 1}} 2020-06-17T00:19:27 ============= 2020-06-17T00:19:27 Running Tests 2020-06-17T00:19:27 ============= 2020-06-17T00:19:27 To run the current test suite, execute the following from the root of he project:: 2020-06-17T00:19:27 $ python -m unittest discover 2020-06-17T00:19:27 ======= 2020-06-17T00:19:27 License 2020-06-17T00:19:27 ======= 2020-06-17T00:19:27 * Free software: BSD license 2020-06-17T00:19:27 History 2020-06-17T00:19:27 ======= 2020-06-17T00:19:27 1.2.0 (2020-06-16) 2020-06-17T00:19:27 ------------------ 2020-06-17T00:19:27 - added ignore_fields 2020-06-17T00:19:27 - Merge pull request #88 2020-06-17T00:19:27 - Merge pull request #84 2020-06-17T00:19:27 - Merge pull request #77 2020-06-17T00:19:27 - Merge pull request #73 2020-06-17T00:19:27 1.1.2 (2019-10-22) 2020-06-17T00:19:27 ------------------ 2020-06-17T00:19:27 - Merge pull request #63 2020-06-17T00:19:27 - Merge pull request #70 2020-06-17T00:19:27 - Merge pull request #71 2020-06-17T00:19:27 1.1.1 (2019-09-09) 2020-06-17T00:19:27 ------------------ 2020-06-17T00:19:27 - Add json_underscoreize as CamelCaseJSONParser class attribute #44 2020-06-17T00:19:27 1.1.0 (2019-09-09) 2020-06-17T00:19:27 ------------------ 2020-06-17T00:19:27 Long awaited stable release: 2020-06-17T00:19:27 Changes can be viewed: 2020-06-17T00:19:27 https://github.com/vbabiy/djangorestframework-camel-case/compare/e6db468...39ae6bb 2020-06-17T00:19:27 0.1.0 (2013-12-20) 2020-06-17T00:19:27 ------------------ 2020-06-17T00:19:27 * First release on PyPI. 2020-06-17T00:19:27 running egg_info 2020-06-17T00:19:27 creating pip-egg-info/djangorestframework_camel_case.egg-info 2020-06-17T00:19:27 writing top-level names to pip-egg-info/djangorestframework_camel_case.egg-info/top_level.txt 2020-06-17T00:19:27 writing pip-egg-info/djangorestframework_camel_case.egg-info/PKG-INFO 2020-06-17T00:19:27 writing dependency_links to pip-egg-info/djangorestframework_camel_case.egg-info/dependency_links.txt 2020-06-17T00:19:27 writing manifest file 'pip-egg-info/djangorestframework_camel_case.egg-info/SOURCES.txt' 2020-06-17T00:19:27 reading manifest file 'pip-egg-info/djangorestframework_camel_case.egg-info/SOURCES.txt' 2020-06-17T00:19:27 reading manifest template 'MANIFEST.in' 2020-06-17T00:19:27 writing manifest file 'pip-egg-info/djangorestframework_camel_case.egg-info/SOURCES.txt' 2020-06-17T00:19:27 Source in /tmp/pip-wheel-5bj0ecb8/djangorestframework-camel-case has version 1.2.0, which satisfies requirement djangorestframework-camel-case==1.2.0 from https://files.pythonhosted.org/packages/74/f8/abbf5e903f4b946542c74e193adc7aa6121d06887d7ac5f87664935e8554/djangorestframework-camel-case-1.2.0.tar.gz#sha256=9714d43fba5bb654057c29501649684d3d9f11a92319ae417fd4d65e80d1159d 2020-06-17T00:19:27 Removed djangorestframework-camel-case==1.2.0 from https://files.pythonhosted.org/packages/74/f8/abbf5e903f4b946542c74e193adc7aa6121d06887d7ac5f87664935e8554/djangorestframework-camel-case-1.2.0.tar.gz#sha256=9714d43fba5bb654057c29501649684d3d9f11a92319ae417fd4d65e80d1159d from build tracker '/tmp/pip-req-tracker-h1km682p' 2020-06-17T00:19:27 Building wheels for collected packages: djangorestframework-camel-case 2020-06-17T00:19:27 Created temporary directory: /tmp/pip-wheel-2y6unqfl 2020-06-17T00:19:27 Building wheel for djangorestframework-camel-case (setup.py): started 2020-06-17T00:19:27 Destination directory: /tmp/pip-wheel-2y6unqfl 2020-06-17T00:19:27 Running command /usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-wheel-5bj0ecb8/djangorestframework-camel-case/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-2y6unqfl 2020-06-17T00:19:29 ==================================== 2020-06-17T00:19:29 Django REST Framework JSON CamelCase 2020-06-17T00:19:29 ==================================== 2020-06-17T00:19:29 .. image:: https://travis-ci.org/vbabiy/djangorestframework-camel-case.png?branch=master 2020-06-17T00:19:29 :target: https://travis-ci.org/vbabiy/djangorestframework-camel-case 2020-06-17T00:19:29 .. image:: https://badge.fury.io/py/djangorestframework-camel-case.svg 2020-06-17T00:19:29 :target: https://badge.fury.io/py/djangorestframework-camel-case 2020-06-17T00:19:29 Camel case JSON support for Django REST framework. 2020-06-17T00:19:29 ============ 2020-06-17T00:19:29 Installation 2020-06-17T00:19:29 ============ 2020-06-17T00:19:29 At the command line:: 2020-06-17T00:19:29 $ pip install djangorestframework-camel-case 2020-06-17T00:19:29 Add the render and parser to your django settings file. 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 REST_FRAMEWORK = { 2020-06-17T00:19:29 'DEFAULT_RENDERER_CLASSES': ( 2020-06-17T00:19:29 'djangorestframework_camel_case.render.CamelCaseJSONRenderer', 2020-06-17T00:19:29 'djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer', 2020-06-17T00:19:29 # Any other renders 2020-06-17T00:19:29 ), 2020-06-17T00:19:29 'DEFAULT_PARSER_CLASSES': ( 2020-06-17T00:19:29 # If you use MultiPartFormParser or FormParser, we also have a camel case version 2020-06-17T00:19:29 'djangorestframework_camel_case.parser.CamelCaseFormParser', 2020-06-17T00:19:29 'djangorestframework_camel_case.parser.CamelCaseMultiPartParser', 2020-06-17T00:19:29 'djangorestframework_camel_case.parser.CamelCaseJSONParser', 2020-06-17T00:19:29 # Any other parsers 2020-06-17T00:19:29 ), 2020-06-17T00:19:29 } 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 ================= 2020-06-17T00:19:29 Swapping Renderer 2020-06-17T00:19:29 ================= 2020-06-17T00:19:29 By default the package uses `rest_framework.renderers.JSONRenderer`. If you want 2020-06-17T00:19:29 to use another renderer (the only possible alternative is 2020-06-17T00:19:29 `rest_framework.renderers.UnicodeJSONRenderer`, only available in DRF < 3.0), you must specify it in your django 2020-06-17T00:19:29 settings file. 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 JSON_CAMEL_CASE = { 2020-06-17T00:19:29 'RENDERER_CLASS': 'rest_framework.renderers.UnicodeJSONRenderer' 2020-06-17T00:19:29 } 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 ===================== 2020-06-17T00:19:29 Underscoreize Options 2020-06-17T00:19:29 ===================== 2020-06-17T00:19:29 **No Underscore Before Number** 2020-06-17T00:19:29 As raised in `this comment `_ 2020-06-17T00:19:29 there are two conventions of snake case. 2020-06-17T00:19:29 .. code-block:: text 2020-06-17T00:19:29 # Case 1 (Package default) 2020-06-17T00:19:29 v2Counter -> v_2_counter 2020-06-17T00:19:29 fooBar2 -> foo_bar_2 2020-06-17T00:19:29 # Case 2 2020-06-17T00:19:29 v2Counter -> v2_counter 2020-06-17T00:19:29 fooBar2 -> foo_bar2 2020-06-17T00:19:29 By default, the package uses the first case. To use the second case, specify it in your django settings file. 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 REST_FRAMEWORK = { 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 'JSON_UNDERSCOREIZE': { 2020-06-17T00:19:29 'no_underscore_before_number': True, 2020-06-17T00:19:29 }, 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 } 2020-06-17T00:19:29 Alternatively, you can change this behavior on a class level by setting `json_underscoreize`: 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 from djangorestframework_camel_case.parser import CamelCaseJSONParser 2020-06-17T00:19:29 from rest_framework.generics import CreateAPIView 2020-06-17T00:19:29 class NoUnderscoreBeforeNumberCamelCaseJSONParser(CamelCaseJSONParser): 2020-06-17T00:19:29 json_underscoreize = {'no_underscore_before_number': True} 2020-06-17T00:19:29 class MyView(CreateAPIView): 2020-06-17T00:19:29 queryset = MyModel.objects.all() 2020-06-17T00:19:29 serializer_class = MySerializer 2020-06-17T00:19:29 parser_classes = (NoUnderscoreBeforeNumberCamelCaseJSONParser,) 2020-06-17T00:19:29 ============= 2020-06-17T00:19:29 Ignore Fields 2020-06-17T00:19:29 ============= 2020-06-17T00:19:29 You can also specify fields which should not have their data changed. 2020-06-17T00:19:29 The specified field(s) would still have their name change, but there would be no recursion. 2020-06-17T00:19:29 For example: 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 data = {"my_key": {"do_not_change": 1}} 2020-06-17T00:19:29 Would become: 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 {"myKey": {"doNotChange": 1}} 2020-06-17T00:19:29 However, if you set in your settings: 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 REST_FRAMEWORK = { 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 "JSON_UNDERSCOREIZE": { 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 "ignore_fields": ("my_key",), 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 }, 2020-06-17T00:19:29 # ... 2020-06-17T00:19:29 } 2020-06-17T00:19:29 The `my_key` field would not have its data changed: 2020-06-17T00:19:29 .. code-block:: python 2020-06-17T00:19:29 {"myKey": {"do_not_change": 1}} 2020-06-17T00:19:29 ============= 2020-06-17T00:19:29 Running Tests 2020-06-17T00:19:29 ============= 2020-06-17T00:19:29 To run the current test suite, execute the following from the root of he project:: 2020-06-17T00:19:29 $ python -m unittest discover 2020-06-17T00:19:29 ======= 2020-06-17T00:19:29 License 2020-06-17T00:19:29 ======= 2020-06-17T00:19:29 * Free software: BSD license 2020-06-17T00:19:29 History 2020-06-17T00:19:29 ======= 2020-06-17T00:19:29 1.2.0 (2020-06-16) 2020-06-17T00:19:29 ------------------ 2020-06-17T00:19:29 - added ignore_fields 2020-06-17T00:19:29 - Merge pull request #88 2020-06-17T00:19:29 - Merge pull request #84 2020-06-17T00:19:29 - Merge pull request #77 2020-06-17T00:19:29 - Merge pull request #73 2020-06-17T00:19:29 1.1.2 (2019-10-22) 2020-06-17T00:19:29 ------------------ 2020-06-17T00:19:29 - Merge pull request #63 2020-06-17T00:19:29 - Merge pull request #70 2020-06-17T00:19:29 - Merge pull request #71 2020-06-17T00:19:29 1.1.1 (2019-09-09) 2020-06-17T00:19:29 ------------------ 2020-06-17T00:19:29 - Add json_underscoreize as CamelCaseJSONParser class attribute #44 2020-06-17T00:19:29 1.1.0 (2019-09-09) 2020-06-17T00:19:29 ------------------ 2020-06-17T00:19:29 Long awaited stable release: 2020-06-17T00:19:29 Changes can be viewed: 2020-06-17T00:19:29 https://github.com/vbabiy/djangorestframework-camel-case/compare/e6db468...39ae6bb 2020-06-17T00:19:29 0.1.0 (2013-12-20) 2020-06-17T00:19:29 ------------------ 2020-06-17T00:19:29 * First release on PyPI. 2020-06-17T00:19:29 running bdist_wheel 2020-06-17T00:19:29 running build 2020-06-17T00:19:29 running build_py 2020-06-17T00:19:30 creating build 2020-06-17T00:19:30 creating build/lib 2020-06-17T00:19:30 creating build/lib/djangorestframework_camel_case 2020-06-17T00:19:30 copying djangorestframework_camel_case/settings.py -> build/lib/djangorestframework_camel_case 2020-06-17T00:19:30 copying djangorestframework_camel_case/util.py -> build/lib/djangorestframework_camel_case 2020-06-17T00:19:30 copying djangorestframework_camel_case/render.py -> build/lib/djangorestframework_camel_case 2020-06-17T00:19:30 copying djangorestframework_camel_case/parser.py -> build/lib/djangorestframework_camel_case 2020-06-17T00:19:30 copying djangorestframework_camel_case/__init__.py -> build/lib/djangorestframework_camel_case 2020-06-17T00:19:30 running egg_info 2020-06-17T00:19:30 writing dependency_links to djangorestframework_camel_case.egg-info/dependency_links.txt 2020-06-17T00:19:30 writing top-level names to djangorestframework_camel_case.egg-info/top_level.txt 2020-06-17T00:19:30 writing djangorestframework_camel_case.egg-info/PKG-INFO 2020-06-17T00:19:30 reading manifest file 'djangorestframework_camel_case.egg-info/SOURCES.txt' 2020-06-17T00:19:30 reading manifest template 'MANIFEST.in' 2020-06-17T00:19:30 writing manifest file 'djangorestframework_camel_case.egg-info/SOURCES.txt' 2020-06-17T00:19:30 installing to build/bdist.linux-armv7l/wheel 2020-06-17T00:19:30 running install 2020-06-17T00:19:30 running install_lib 2020-06-17T00:19:30 creating build/bdist.linux-armv7l 2020-06-17T00:19:30 creating build/bdist.linux-armv7l/wheel 2020-06-17T00:19:30 creating build/bdist.linux-armv7l/wheel/djangorestframework_camel_case 2020-06-17T00:19:30 copying build/lib/djangorestframework_camel_case/settings.py -> build/bdist.linux-armv7l/wheel/djangorestframework_camel_case 2020-06-17T00:19:30 copying build/lib/djangorestframework_camel_case/util.py -> build/bdist.linux-armv7l/wheel/djangorestframework_camel_case 2020-06-17T00:19:30 copying build/lib/djangorestframework_camel_case/render.py -> build/bdist.linux-armv7l/wheel/djangorestframework_camel_case 2020-06-17T00:19:30 copying build/lib/djangorestframework_camel_case/parser.py -> build/bdist.linux-armv7l/wheel/djangorestframework_camel_case 2020-06-17T00:19:30 copying build/lib/djangorestframework_camel_case/__init__.py -> build/bdist.linux-armv7l/wheel/djangorestframework_camel_case 2020-06-17T00:19:30 running install_egg_info 2020-06-17T00:19:30 Copying djangorestframework_camel_case.egg-info to build/bdist.linux-armv7l/wheel/djangorestframework_camel_case-1.2.0-py3.5.egg-info 2020-06-17T00:19:30 running install_scripts 2020-06-17T00:19:30 creating build/bdist.linux-armv7l/wheel/djangorestframework_camel_case-1.2.0.dist-info/WHEEL 2020-06-17T00:19:30 Building wheel for djangorestframework-camel-case (setup.py): finished with status 'done' 2020-06-17T00:19:30 Stored in directory: /tmp/tmp5v_u4xx8 2020-06-17T00:19:30 Successfully built djangorestframework-camel-case 2020-06-17T00:19:30 Cleaning up... 2020-06-17T00:19:30 Removing source in /tmp/pip-wheel-5bj0ecb8/djangorestframework-camel-case 2020-06-17T00:19:30 Removed build tracker '/tmp/pip-req-tracker-h1km682p'