Commit Graph

3199 Commits

Author SHA1 Message Date
Matt Davis
99569190ab If pagination class, include the schema generation
https://github.com/encode/django-rest-framework/issues/5144
2017-05-22 19:10:54 -04:00
Thomas Achtemichuk
70205cc64e
Lint 2017-05-17 15:17:55 -04:00
Thomas Achtemichuk
c9c383dfad
Don't trim whitespace from authtoken passwords
* Fixes #5148
2017-05-17 14:52:39 -04:00
imdark
3a2ad8e68c in order to solve the memory leak at #5146
Large encoded string take a very long time to to release from memory, but if we just pass the stream directly into json.load we get much better memory performance.
2017-05-17 11:49:30 -07:00
Daniel Hahler
09f62e11a0 Possible fix 2017-05-16 12:07:04 +02:00
Vimarsh Chaturvedi
7b4afdc737 Merge branch 'master' into issue4989 2017-05-13 19:10:47 +05:30
vimarshc
b2d6149301 importing regex constant to remove invalid parameters. 2017-05-13 05:14:32 +05:30
Tom Christie
a99f12f1c6 Merge branch 'master' into version-3-6-3 2017-05-12 17:03:32 +01:00
Tom Christie
42f80c65a9 Version 3.6.3 2017-05-12 16:52:27 +01:00
Tom Christie
e8ff5e268b Javascript fixes for API docs 2017-05-12 16:48:53 +01:00
Nabil Jamaleddine
cdb8a3c3c8 Add ValidationError to except in get_object_or_404 for django 1.11 2017-05-05 21:17:12 -04:00
Tom Christie
69b0ac52c2 Merge pull request #5117 from rpkilby/fix-filter-backend
Fix DjangoFilterBackend mro
2017-05-04 12:32:03 +01:00
German Ilyin
5246a5a44e Fix a typo in a comment 2017-05-04 10:13:58 +06:00
Ryan P Kilby
01ffb8961d Fix DjangoFilterBackend mro 2017-05-03 12:51:44 -04:00
Tom Christie
97312699f5 Merge pull request #5085 from hurturk/schema-method-limited
Generate schema with respect to http_method_names provided by CBV
2017-05-03 09:16:01 +01:00
hurturk
518bb44a9e Remove excessive class instance while getting http_method_names 2017-05-03 03:49:04 -04:00
hurturk
6075f8051a Refactor CBV schema method limitation for set operations 2017-05-02 17:34:53 -04:00
Tom Christie
60dbe72a62 Merge pull request #4437 from dfavato/master
Set self.count before self.limit in LimitOffsetPagination
2017-05-02 10:21:36 +01:00
Tom Christie
dea601dc86 Merge pull request #4222 from NewVadim/master
Fix partial update for the ListSerializer.
2017-05-02 10:17:12 +01:00
Tom Christie
d2d0a06faf Merge pull request #5084 from Nerlin/fix-render-required-nested-serializer-error
Fixed render error of required nested serializer.
2017-05-02 10:05:25 +01:00
Tom Christie
80d0ee563a Merge pull request #5042 from boxingwizards/i4999
PoC Add JSONBoundField to serializers (Fixes #4999)
2017-04-27 20:26:40 +01:00
Tom Christie
5ba2368ff9 Merge pull request #4987 from halfstrik/master
Added test for DateTimeField validation when server has timezone with…
2017-04-27 17:22:27 +01:00
Tom Christie
aafd0a644f Merge pull request #4979 from linovia/feature/improve_schema_shortcut
Restrict doc & schema shortcuts to a subset of urls
2017-04-27 16:58:01 +01:00
Tom Christie
5e5fd67899 Merge pull request #5086 from valohai/limit-offset-pagination-schema
SchemaGenerator: Avoid crashing with pagesizeless paginators
2017-04-27 16:57:28 +01:00
Tom Christie
ee1a9fcef6 Merge pull request #5078 from rooterkyberian/issue-4748
add URL path unquote to HyperlinkedRelatedField.to_internal_value
2017-04-27 16:27:04 +01:00
Dave Allan
f56b117064 Pass non-JSON serializable values through unmodified 2017-04-26 14:10:47 -04:00
Dave Allan
7a0bd1c4d1 Use text area for JSON fields and indent JSON 2017-04-26 14:10:47 -04:00
Dave Allan
11d8e4df88 PoC Add JSONBoundField to serializers (Fixes #4999)
Per issue #4999, JSONFields are not rendered properly in the DRF
browsable API HTML forms.  This patch attempts to fix that behavior by
introducing a JSONBoundField helper similar to the NestedBoundField
helper.
2017-04-26 14:10:47 -04:00
Aarni Koskela
72da73310d SchemaGenerator: Avoid crashing with pagesizeless paginators 2017-04-19 09:43:28 +03:00
Xavier Ordoquy
778aee1bb3 Merge master. 2017-04-19 07:56:39 +02:00
hurturk
2196cd2bbb Generate schema with respect to http_method_names provided by CBV 2017-04-18 23:44:18 -04:00
nerlin
ed72603d35 Fixed render error of required nested serializer.
Fixes an error that occurs on rendering response with error that says that required nested serializer field must be specified in data.
2017-04-19 03:18:52 +03:00
Aarni Koskela
53f48d1564 Allow customizing DefaultRouter's schema generator class 2017-04-18 14:14:04 +03:00
Aarni Koskela
51a6c076e2 Allow customizing the SchemaGenerator class for docs 2017-04-18 14:14:04 +03:00
Maciej Urbanski
5e185aa26b add URL path unquote to HyperlinkedRelatedField.to_internal_value 2017-04-14 01:56:44 +02:00
Xavier Ordoquy
d757127e9a Merge remote-tracking branch 'reference/master' into feature/improve_schema_shortcut
* reference/master: (22 commits)
  Clarify get_schema_fields signature
  Updated monthly report link on funding page
  Bumped django-guardian version.
  remove django 1.11 from allow_failure matrix
  update django 1.11 to stable release in tox
  Update existing vary headers in response instead of overwriting them.
  Update links after moving to encode org
  Use overridden settings exception handler
  Pass initkwargs stored on view to instance
  Update 7-schemas-and-client-libraries.md
  Update Boolean field to more closely match python library
  Fix parser names in docstring.
  Fix typo at docstring
  update test case
  update test case
  fix unique=True validation for ChoiceField
  Added drfpasswordless to Authentication docs
  Document adding django_filters to installed apps
  Added drfpasswordless to third party packages topic page.
  Added drfpasswordless to authentication topic page.
  ...
2017-04-13 08:29:47 +02:00
Tom Christie
d300c3c648 Merge pull request #5047 from kirberich/merge-vary-headers
Update existing vary headers in response instead of overwriting them.
2017-04-07 20:44:58 +01:00
Tom Christie
33290170e8 Merge pull request #5060 from jpadilla/encode
Update links after moving to encode org
2017-04-07 17:20:51 +01:00
Robert Kirberich
9ebd5a29e4 Update existing vary headers in response instead of overwriting them.
Previously, any existing vary headers would simply be wiped out by DRF. Using patch_vary_headers assures that existing headers remain.
2017-04-07 17:06:09 +01:00
José Padilla
c1f31492ae
Update links after moving to encode org 2017-04-07 10:28:35 -04:00
Tom Christie
bbe0df2916 Merge pull request #5053 from s-m-b/patch-1
Pass initkwargs stored on view to instance
2017-04-07 08:29:34 +01:00
Ian Cordasco
c2ee1b3033 Use overridden settings exception handler
Instead of using the api_settings exception handler, we use the
overridden settings attribute to find the correct handler.

Closes #5054
2017-04-06 14:05:29 -05:00
s-m-b
f1ca71ce21 Pass initkwargs stored on view to instance 2017-04-06 16:38:28 +04:00
htmis
4a54d9f474 Update Boolean field to more closely match python library
Python Reference:
distutils.util.strtobool(val)
Convert a string representation of truth to true (1) or false (0).
True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0. Raises ValueError if val is anything else.
2017-03-29 20:21:18 -04:00
Xavier Ordoquy
d417c6d1b9 Fix parser names in docstring. 2017-03-29 07:57:14 +02:00
Ilya Beda
f27c551218 Fix typo at docstring 2017-03-29 12:51:01 +07:00
Ekluv
56fe0e4b3f fix unique=True validation for ChoiceField 2017-03-28 00:38:21 +05:30
Xavier Ordoquy
6ad0be44d3 Merge remote-tracking branch 'reference/master' into feature/improve_schema_shortcut
* reference/master:
  use django 1.11rc1 in tox
  Leave parameters with regex pattern as String
  restored original formatting
  Do not hint BigAutoField as integer (outside of range)
  Mention where the mixins live
  Try to improve browser support
  Cleanup and refactor docs api.js script
  Move bootstrap modal data attrs to anchor
  Remove unused base.js script
  Correctly set scheme in coreapi TokenAuthentication
  reverted to fix the issue without changing setting
  DEFAULT_PAGINATION_CLASS is changed to 'None'
  add content block and breadcrumbs_empty block to allow base.html to be reused
  Update 7-schemas-and-client-libraries.md
  Updated testimonial name on funding site
  ID must start from 1 again
2017-03-24 15:21:43 +01:00
Tom Christie
0fdaf4f481 Merge pull request #5001 from jpadilla/docs-cleanup
JavaScript cleanup in API Docs.
2017-03-22 14:01:00 +00:00
Tom Christie
8e9cb1e614 Merge pull request #5014 from dczech/feature/decouple-bigautofield
Include URL path regexs in API schemas where valid.
2017-03-22 09:37:07 +00:00
Sergey Petrunin
b0a0c30bfe Added pytz exception in compat module.
Mock pytz.timezone localize in tests.
Ref: #4986
2017-03-22 00:03:32 -04:00
Dariusz Czech
54d0901f38 Leave parameters with regex pattern as String 2017-03-21 15:15:20 +01:00
Dariusz Czech
9074e3e478 restored original formatting 2017-03-21 08:40:59 +01:00
Sergey Petrunin
e4a1bd140b Update error message.
Ref: #4986
2017-03-20 18:47:25 -04:00
Dariusz Czech
c7e2d1d976 Do not hint BigAutoField as integer (outside of range) 2017-03-20 22:21:07 +01:00
Tom Christie
7d64cf568a Merge pull request #4998 from COCOLMAN/master
Ensure that pagination is not included in API schema when `page_size=None`.
2017-03-20 15:32:44 +00:00
Sergey Petrunin
d4726dab81 Fix bug for not existent or ambiguous datetime during native to aware conversion in timezone with DST.
Ref: #4986
2017-03-18 23:13:26 -04:00
José Padilla
9e18d005d1
Try to improve browser support 2017-03-17 22:21:14 -04:00
José Padilla
b0f2ec785e
Cleanup and refactor docs api.js script 2017-03-17 21:44:40 -04:00
José Padilla
d8507d3f9c
Move bootstrap modal data attrs to anchor 2017-03-17 21:44:11 -04:00
José Padilla
be0e196e65
Remove unused base.js script 2017-03-17 21:43:20 -04:00
José Padilla
7e76cd8695
Correctly set scheme in coreapi TokenAuthentication 2017-03-17 20:27:36 -04:00
sol HYUN
16aad89459 reverted to fix the issue without changing setting 2017-03-18 06:17:35 +09:00
sol HYUN
9c3edb0921 DEFAULT_PAGINATION_CLASS is changed to 'None'
because the default value was specified, it did not work properly in API
Document
2017-03-18 04:50:01 +09:00
Jeff Johnson
323f59091c add content block and breadcrumbs_empty block to allow base.html to be reused 2017-03-16 09:03:45 -04:00
Xavier Ordoquy
b558c9ecc4 Allow the documentation and schema shortcut functions to get a list of urls to introspect. 2017-03-15 08:07:12 +01:00
Tom Christie
3b466fabe7 Merge pull request #4973 from tomchristie/support-head-in-viewsets
Support HEAD in viewsets
2017-03-13 13:16:04 +00:00
Tom Christie
43b38964ea Support HEAD in viewsets 2017-03-13 12:51:03 +00:00
Tom Christie
0173e9bd21 Use 'items' templatetag throughout. 2017-03-13 12:35:19 +00:00
Tom Christie
2df80c3c9d Merge pull request #4688 from theosotr/feature-source
Support usage of 'source' in `extra_kwargs`.
2017-03-13 10:25:38 +00:00
Tom Christie
d508a3dd1e Merge pull request #4967 from 0xKD/patch-2
Update coreapi.js version in JavaScript API docs.
2017-03-13 10:06:35 +00:00
Tom Christie
de9a8c4811 Fix mime type on schema.js endpoint. Closes #4968. 2017-03-13 10:03:13 +00:00
Kedar
9e62bc51ec Update coreapi.js version 2017-03-11 11:19:26 +05:30
Tom Christie
928f7cb40f Version 3.6.2 2017-03-10 13:00:08 +00:00
Tom Christie
7a8fb262f2 Fallback to more widely supported JS feature sets. (#4961) 2017-03-10 12:07:15 +00:00
Tom Christie
9ccdc4366f Merge branch 'master' of github.com:tomchristie/django-rest-framework 2017-03-10 10:59:39 +00:00
Tom Christie
9baa1fde15 Add 'mark_safe' in template tags. Closes #4952. Closes #4953. 2017-03-10 10:59:31 +00:00
Michael Palmer
81887bdc4e Add glyphicon fonts to static docs (#4951)
* Fixes #4950.
2017-03-10 10:37:31 +00:00
Tom Christie
f51bb5ac8b Drop unneeded comment 2017-03-10 09:10:29 +00:00
Chris Carty
bc2c76a000 fixed issue on schemas.py where if model._meta.get_field(variable) failed model_field was not set to None and would reult in an error 2017-03-09 21:11:52 -05:00
Tom Christie
544b4b9948 Ensure 'markdown' dependancy is optional. Refs #4941. (#4947) 2017-03-09 16:50:00 +00:00
Tom Christie
52db57a6e7 Version 3.6 (#4943) 2017-03-09 14:49:51 +00:00
Xavier Ordoquy
537df7a6ad Extract APISchemaView and APIRootView out of the DefaultRouter. (#4707) 2017-03-07 13:39:08 +00:00
Tibo Beijen
cf5d401a0e Allow required false and default (#4692)
* Default value will now be used when serializing if key or attribute is missing.
2017-03-07 13:19:19 +00:00
Tom Christie
68d2020112 Live API documentation (#4755) 2017-03-03 15:24:37 +00:00
Tim Watts
8df340908b Add failing tests and fix for dict that have a key items #4931 (#4932) 2017-03-03 09:23:09 +00:00
tdruez
06a1e12fd8 Fixed Permissions.get_required_object_permissions for #4927 2017-02-28 17:51:32 +01:00
Ran Benita
7a408f6cd2 Guard against the possible misspelling readonly_fields in model serializers
Fixes #4897.
2017-02-22 13:27:23 +02:00
Lanrik
5986f95c8d Rearrange code (#4908)
Minor refactor. Move assignment to after `None` check.
2017-02-20 09:48:19 +00:00
Pavlin Gergov
eacb93d453 Update _not_authenticated's docstring (#4906) 2017-02-20 09:33:54 +00:00
Isaac Stone
289e1e440e Check for collection.Mapping instead of dict
issue #4901
2017-02-19 13:10:03 -08:00
Mariusz Felisiak
40e3462767
Reverted "Removed multi-table inheritance auto created PK from serialize" 1ecbeebbe5. 2017-02-11 17:39:47 +01:00
Tom Christie
eb5774229f Version 3.5.4 (#4894) 2017-02-10 11:15:39 +00:00
李扬
cbad236f6d Add max_length and min_length arguments for ListField (#4877) 2017-02-06 09:36:03 +00:00
Xavier Ordoquy
f4707ad0e0 Merge pull request #4870 from felixxm/issue-dedent
Fixed `dedent` for tab indent.
2017-02-02 11:01:37 +01:00
Mohammad Ashraful Islam
2ec3db8177 fixed url checker ':' to 'http' (#4678) 2017-02-01 12:20:06 +00:00
Mariusz Felisiak
b99272c425
Fixed dedent for tab indent. 2017-01-31 20:57:52 +01:00
Mariusz Felisiak
3001b56e06 Fixed Django 2.0 compatibility due to django.conf.urls.include parameters change. (#4866) 2017-01-30 16:11:19 +00:00
Mariusz Felisiak
1c437a793c
Removed unnecessary importlib wrapper. 2017-01-29 20:38:39 +01:00
Mariusz Felisiak
1ecbeebbe5 Fixed #4574 -- Removed multi-table inheritance auto created PK from serialize. (#4852) 2017-01-26 14:18:43 +00:00
Ekwenugo Mirabel
217a81f19b Use correct label for username field in login template (#4841) 2017-01-24 09:07:32 +00:00
Mariusz Felisiak
5c0f9f147c Removed unnecessary utc wrapper. (#4839) 2017-01-23 16:22:32 +00:00
Luca
635dc03529 Parametrizable viewset custom views reverse name (#4821) 2017-01-19 15:20:34 +00:00
Asif Saifuddin Auvi
026a8d8707 make lint happy with isort --recursive 2017-01-18 22:15:44 +06:00
Asif Saifuddin Auvi
bc3849bd59 added utc compat to fields 2017-01-18 19:31:04 +06:00
Asif Saifuddin Auvi
5717e853db fix import of utc 2017-01-18 19:28:57 +06:00
Asif Saifuddin Auvi
5436df54c6 added compat shim for utc/UTC 2017-01-18 19:06:41 +06:00
Artem Muterko
06a5bcc88e Add mediatype tests (#4813) 2017-01-16 18:17:51 +00:00
Ryan P Kilby
50c2d71a80 tox/travis maintenance (#4811)
* Use py36 on travis

* Remove basepython from tox

* Use py27 on travis

* Use version ranges for dependencies

* Use tox-travis to sync python/env factors

* Add toxenv/django env vars to codecov build vars

* Use raw string to fix py36 invalid escape sequence
2017-01-16 13:51:07 +00:00
Artem Muterko
b6b2c4bb5b Renderer tests (#4791) 2017-01-08 16:33:43 +00:00
Artem Muterko
4dd71d68d2 Remove extra parentheses (#4789) 2017-01-08 16:09:23 +00:00
Artem Muterko
773b68e188 Fix typos in Python files 2017-01-08 15:36:49 +02:00
Roman Vasilyev
64e801e479 get view for django 'virtual hosts' (#4776)
Brill, thanks! 👍
2017-01-06 22:46:36 +00:00
Artem Muterko
a5fcf10c0e Raise RuntimeError when trying to encode coreapi objects (#4790) 2017-01-06 22:32:13 +00:00
Ryan P Kilby
11fd3bf108 Add disabling of declared fields on serializer subclasses (#4764)
* Add test for disabling declared fields on child
* Check that declared base field is not in attrs
* Update meta inheritance docs to include serializer
* Test that meta fields cannot be declared as None
* Add docs example for declarative field disabling
2017-01-03 21:14:19 +00:00
Nik Nyby
24e082b142 docs: typo fix: it's -> its 2016-12-22 12:44:43 -05:00
Matthew Medal
93fe531dea Breadcrumb view name suffix fix (#4750)
* add failing testcase for breadcrumb suffixes missing when using ModelViewSets

* fix get_breadcrumbs to honor overridden get_view_name and keep viewset suffixes

* ensure suffixes are appended in breadcrumb util
2016-12-20 22:19:00 +00:00
Christian Hess
f38734ef98 Add new line correctly in docstring sections (#4759)
The order of the line break was wrong
2016-12-20 16:26:18 +00:00
Eduard Iskandarov
ebe174c0d7 add per-view custom exception handler support (#4753) 2016-12-15 12:36:40 +00:00
Thodoris Sotiropoulos
4c2d6b9bb7 Do not ignore source when building fields dynamically
This commit fixes the issue when you set the keyword argument `source`
and your have not set the serializer fields explicitly. Then the
construction of field failed because there is not actually any model
field with that name.

However, you are still able to imply the name of model field by
providing the `source` keyword argument.
2016-11-17 18:51:22 +02:00
Tom Christie
24791cb353 Invalidate any existing prefetch cache on PUT requests. (#4668) 2016-11-11 09:44:35 +00:00
Tom Christie
8bab7f8d58 Only apply the nested writes test to writable fields. (#4669) 2016-11-10 16:36:56 +00:00
Tom Christie
ea60872e9e Version 3.5.3 [ci skip] 2016-11-07 13:38:48 +00:00
Tom Christie
8d72535be9 Fix FilterSet warnings. (#4660) 2016-11-07 12:55:18 +00:00
Rex Salisbury
06df61e38c handle error when no links are found (#4649)
This is to address https://github.com/tomchristie/django-rest-raml/issues/5

The problem is that if you try to generate RAML docs when you haven't set up any views, you get the above error (min called on an empty list).  

unfortunately, this PR is not very helpful since it doesn't actually surface a readable error to the user.  Not sure what the best way to address this would be...
2016-11-07 11:41:10 +00:00
James Beith
befacfb00d Add autofocus support for input.html templates (#4650)
This change adds support to use `'autofocus': True` in the style options and have the `autofocus` attribute included on the input field when rendered.
2016-11-07 11:34:53 +00:00
Andrzej Pragacz
45e058d7ba Fix unhandled Http404, PermissionDenied in schema generation (#4645) (#4646) 2016-11-02 09:04:01 +00:00
Tom Christie
2bf082a623 Version 3.5.2 [ci skip] (#4641) 2016-11-01 11:31:20 +00:00
Tom Christie
276ed80fd3 Support 'on'/'off' literals with BooleanField. Closes #4624 (#4640) 2016-11-01 11:11:34 +00:00
Kennedy Mwenja
7038571157 Enable cursor pagination of value querysets. (#4569)
To do `GROUP_BY` queries in django requires one to use `.values()`
eg this groups posts by user getting a count of posts per user.

```
Posts.objects.order_by('user').values('user').annotate(post_count=Count('post'))
```

This would produce a value queryset which serializes its result
objects as dictionaries while `CursorPagination` requires a queryset
with result objects that are model instances.

This commit enables cursor pagination for value querysets.

- had to mangle the tests a bit to test it out. They might need
  some refactoring.
- tried the same for `.values_list()` but it turned out to be
  trickier than I expected since you have to use tuple indexes.
2016-11-01 10:42:01 +00:00
Nicolas Delaby
97d848413e Fix support of get_full_details() for Throttled exceptions (#4627)
Since `str` objects are immutable, appending to existing `str` creates
in fact a new `str` instance.

Thus `ErrorDetail.detail.code` attribute is lost after `str` concatenation operation.
2016-11-01 10:38:56 +00:00
Kieran Spear
98df932194 Fix FilterSet proxy (#4620) 2016-11-01 10:30:17 +00:00
Ryan P Kilby
d92b24a0b7 Make serializer fields import explicit (#4628) 2016-11-01 10:27:11 +00:00
Tom Christie
5c54b227c1 Drop redundant requests adapter (#4639) 2016-11-01 10:24:53 +00:00
Tom Christie
7eb6cdca00 Don't lose exception info (#4638) 2016-11-01 10:22:30 +00:00
Alex Kahan
895c67c9a2 Fixes #4532 (#4636) 2016-10-31 20:41:54 +00:00
Ryan P Kilby
eafc9a2393 Fix is_simple_callable with variable args, kwargs (#4622) 2016-10-25 20:47:24 +01:00
Tom Christie
3b39d2d13a Version 3.5.1 [ci skip] 2016-10-21 17:10:38 +01:00
Tom Christie
30bf9df5d0 Fix guardian import (#4612) 2016-10-21 16:59:43 +01:00
Tom Christie
0fe0e1e703 Fix schema base paths (#4611) 2016-10-21 16:59:34 +01:00
Tom Christie
f1bdce17b5 Fix for case of ListSerializer with single item (#4609) 2016-10-21 15:21:23 +01:00
Lukasz Karolewski
0b346e94b1 changing order of imports (#4601)
when using with django-filter and rest_framework_swagger need to import coreapi before django-filter as django filter tries to load rest_framework.coreapi which is undefined at this point
2016-10-21 15:00:25 +01:00
Tom Christie
e3686aca93 Don't use bare 'raise'. [ci skip] 2016-10-21 14:47:26 +01:00
Tom Christie
2395fb5386 Deprecate DjangoFilter backend (#4593)
Deprecate the built-in `rest_framework.filters.DjangoFilterBackend` in favour of the third-party `django_filters.rest_framework.DjangoFilterBackend`.
2016-10-20 10:47:09 +01:00
Zach Wernberg
fcff16c5c6 minor typo 2016-10-18 23:14:55 -05:00
Tom Christie
8d0a91b002 Fix 3674 (#4571)
Handle ModelSerializer case for relationships to models with custom pk.
2016-10-13 12:43:43 +01:00
Tom Christie
88c6c380c5 Use field.source to perform check for writable nested field, not key (#4568) 2016-10-12 16:51:01 +01:00
Alexey Evseev
2519ce9128 Fix schema generation with custom page_size pagination param (#4567) 2016-10-12 16:09:45 +01:00
Tom Christie
5677d063d8 Do not treat empty non-form input as HTML. (#4566) 2016-10-12 15:46:24 +01:00
Tom Christie
26e51ecd6c When HTML form input is used with JSONField, treat the input as a JSON encoded string, not a JSON primative. (#4565) 2016-10-12 14:04:10 +01:00
Tom Christie
b419970431 Handle empty data with serializer (#4564) 2016-10-12 10:47:17 +01:00
Tom Christie
11a89ebff4 Removous erronous duplicate Danish translation file (#4563) 2016-10-12 10:02:21 +01:00
SerenityCode
02fcf6a334 Use field name instead of source when generating docs (#4559) 2016-10-12 09:46:59 +01:00
Tom Christie
7f29cfc931 Lazy hyperlink names (#4554) 2016-10-11 12:18:00 +01:00
Tom Christie
d0b3b6470a Fix prefetch_related updates. (#4553) 2016-10-11 11:07:40 +01:00
Akshay Sharma
aed4ed5e73 Browsable API navbar gets overlapped by highlighted pagination item fix (#4547) 2016-10-11 10:59:00 +01:00
Tom Christie
a3802504a0 Error codes (#4550)
Add error codes to `APIException`
2016-10-11 10:25:21 +01:00
Tom Christie
0dec36eb41 Version 3.5 (#4525)
* Start test case

* Added 'requests' test client

* Address typos

* Graceful fallback if requests is not installed.

* Add cookie support

* Tests for auth and CSRF

* Py3 compat

* py3 compat

* py3 compat

* Add get_requests_client

* Added SchemaGenerator.should_include_link

* add settings for html cutoff on related fields

* Router doesn't work if prefix is blank, though project urls.py handles prefix

* Fix Django 1.10 to-many deprecation

* Add django.core.urlresolvers compatibility

* Update django-filter & django-guardian

* Check for empty router prefix; adjust URL accordingly

It's easiest to fix this issue after we have made the regex.  To try
to fix it before would require doing something different for List vs
Detail, which means we'd have to know which type of url we're
constructing before acting accordingly.

* Fix misc django deprecations

* Use TOC extension instead of header

* Fix deprecations for py3k

* Add py3k compatibility to is_simple_callable

* Add is_simple_callable tests

* Drop python 3.2 support (EOL, Dropped by Django)

* schema_renderers= should *set* the renderers, not append to them.

* API client (#4424)

* Fix release notes

* Add note about 'User account is disabled.' vs 'Unable to log in'

* Clean up schema generation (#4527)

* Handle multiple methods on custom action (#4529)

* RequestsClient, CoreAPIClient

* exclude_from_schema

* Added 'get_schema_view()' shortcut

* Added schema descriptions

* Better descriptions for schemas

* Add type annotation to schema generation

* Coerce schema 'pk' in path to actual field name

* Deprecations move into assertion errors

* Use get_schema_view in tests

* Updte CoreJSON media type

* Handle schema structure correctly when path prefixs exist. Closes #4401

* Add PendingDeprecation to Router schema generation.

* Added SCHEMA_COERCE_PATH_PK and SCHEMA_COERCE_METHOD_NAMES

* Renamed and documented 'get_schema_fields' interface.
2016-10-10 13:03:46 +01:00
Camille Harang
e99b30d28b Fix rest_framework.filters.OrderingFilter doesn't pass context to ser… (#4543)
* Fix rest_framework.filters.OrderingFilter doesn't pass context to serializers #4541

* #4541 Additional fix for remove_invalid_fields()
2016-10-10 11:59:02 +01:00
Rowan Seymour
883efbc19f Case insensitive uniqueness validation (#4534) 2016-10-04 13:44:50 +01:00
Dmitry Dygalo
b82ec540ad Remove code for old Django versions (#4513) 2016-09-23 23:03:02 +01:00
Tom Christie
7ab4a587d9 Version 3.4.7 (#4501) 2016-09-21 12:24:26 +01:00
Tom Christie
be74d11165 Fallback behavior for request parsing when request.POST already accessed. (#4500) 2016-09-21 11:49:09 +01:00
Ollie Ford
fe96ceced0 fixes response rendering with empty context (#4495)
This commit allows `response.render` to be called when
`response.rendered_context == {}`. This should be allowed, since
if [the JSONRenderer, for example](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/renderers.py#L85-L92) receives a `None` context, it
sets it to an empty dictionary itself.
2016-09-17 03:13:34 +01:00
Tanner Hobson
fe4c4fa751 Fix indentation regression in API listing (#4493)
In commit 5392be4ddb, there was a change
made when cleaning up the template for the API listing that caused 2
spaces to appear before every header item (except the first) and before
the first line of the body of the response. This meant that it often
looked like:

HTTP 200 OK
  Allow: GET, OPTIONS
  Content-Type: application/json
  Vary: Accept

  {
    "key": "value",
    "key2": "value2"
}

This change removes those leading spaces, so that it will now look like:

HTTP 200 OK
Allow: GET, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "key": "value",
    "key2": "value2"
}
2016-09-17 03:09:49 +01:00
Tom Christie
4655501d51 Fix regression of RegexField. (#4490)
* Don't deepcopy 'regex' arguments, instead treat as immutable.
2016-09-15 12:44:45 +01:00
José Padilla
6b6f319509 Add missing comma (#4473) 2016-09-08 14:01:26 +01:00
TakesxiSximada
5df54a711f Set a view function's __module__ value to the WrappedAPIView object's __module__ (#4465) 2016-09-05 11:16:41 +01:00
Mathieu Pillard
07efbdb45e Fix APIClient.get() when path contains unicode arguments (#4458) 2016-09-02 17:00:03 +01:00
dfavato
ec4761225e Set self.count before self.limit in LimitOffsetPagination
By doing this it is possible to override get_limit in order to return all records if the request has a predefined param.

For example, if one wants that all records are retrieved if url has &limit=-1, get_limit could return self.count in this case.

Otherwise, if self.count is set after self.limit then, to achive the same result, one has to override get_limit and paginate_queryset, or run get_limit twice.
2016-08-23 14:52:20 -03:00
Tom Christie
f064ec6ac6 Version 3.4.6 (#4436) 2016-08-23 16:59:47 +01:00
Tom Christie
97806f9724 Add missing comma 2016-08-23 09:46:03 +01:00
José Padilla
d0ed482d70 Skip HiddenField from Schema fields (#4429) 2016-08-22 16:53:53 +01:00
orf
d540f0262b Improve Create to show the original exception traceback (#3508) 2016-08-19 14:42:13 +01:00
Tom Christie
a335309b33 Add __str__ method to PKOnlyObject (#4423) 2016-08-19 14:37:27 +01:00
Tom Christie
63342e81db Version 3.4.5 (#4421) 2016-08-19 12:45:20 +01:00
Tom Christie
382ea770b5 Improve debug error handling (#4416) 2016-08-18 14:42:15 +01:00
Tom Christie
b76984d222 Allow custom CSRF_HEADER_NAME setting. (#4415) 2016-08-18 11:24:03 +01:00
Tom Christie
e3f8d06baf Include .action attribute on viewsets when generating schemas (#4408) 2016-08-15 17:10:55 +01:00
Tom Christie
101fd29039 Do not include uploads in request.POST (#4407) 2016-08-15 16:53:17 +01:00
Tom Christie
785b206b81 Tweak doctsring. Closes #4404 [ci skip] 2016-08-15 16:21:51 +01:00
James Beith
075a0bde5a Fix template syntax error for as_list_of_strings (#4403) 2016-08-15 09:28:46 +01:00
Tom Christie
a7525d838a Version 3.4.4 (#4395) 2016-08-12 12:08:25 +01:00
Tom Christie
ae720d9bde Fix issue with generating categories for schema endpoints (#4394) 2016-08-12 10:58:47 +01:00
Neil Parsons
7466b61e62 Don't strip empty query params when paginating (#4260) 2016-08-12 10:50:16 +01:00
Leonid Shvechikov
1d26b398ad Fix comment for SerializerMethodField.bind method (#4389)
It seems that the example was copy&pasted and not updated properly.
2016-08-11 22:15:21 +01:00
Tom Christie
ebf43346a1 Do not re-run query for empty results with LimitOffsetPagination (#4388) 2016-08-11 16:54:55 +01:00
Tom Christie
116917dbed Add form field descriptions to schemas (#4387) 2016-08-11 16:18:33 +01:00
Tom Christie
01b498ec51 Fix schema categories for custom list actions (#4386) 2016-08-11 14:07:40 +01:00
Tom Christie
b50d8950ee Pass request to schema generation (#4383)
Pass request to schema generation
2016-08-11 11:27:28 +01:00
Tom Christie
f16e880167 Stricter type validation for CharField. (#4380)
Stricter type validation for CharField
2016-08-10 17:22:19 +01:00
Tom Christie
f1a2eeb818 .choices property of RelatedField should preserve non-string values. (#4379)
Update RelatedField.choices to support non-string values
2016-08-10 16:38:59 +01:00
Akhil Lawrence
fa4ce50be7 Modified exception handler to throw django error page in case of 500 error (#4172)
Show Traceback HTML in browsable API
2016-08-10 15:24:32 +01:00
Daniel Hahler
378b04eeaa Fix handling of ALLOWED_VERSIONS and no DEFAULT_VERSION (#4370)
When only `ALLOWED_VERSIONS` but no `DEFAULT_VERSION` is specified, a
version should be enforced.
2016-08-10 15:19:56 +01:00
Tom Christie
48f3db36d6 Allow optional max_digits on DecimalField (#4377) 2016-08-10 14:39:26 +01:00
Tom Christie
2d43b17f9a Limit queryset when rendering relational choices. (#4375)
Limit querysets to html_cutoff when rendering relational choices
2016-08-10 13:01:10 +01:00
Tom Christie
8105a4ac5a Resolve form display with ChoiceField, MultipleChoiceField and non-string choices. (#4374)
* Add tests for html-form-rendering choice fields
* Resolve issues with ChoiceField, MultipleChoiceField and non-string options
* Ensure None template comparisons don't match string None
2016-08-10 12:02:33 +01:00
Tom Christie
0781182646 Fix call to .resolve_context (#4371) 2016-08-09 17:48:29 +01:00
Dmitry Dygalo
e1768bdc16 Fixed various typos (#4366) 2016-08-08 09:32:22 +01:00
Tom Christie
bb613c5ad1 Version 3.4.3 (#4361)
* Version 3.4.3
2016-08-05 13:33:25 +01:00