Commit Graph

601 Commits

Author SHA1 Message Date
Andrzej Pragacz
45e058d7ba Fix unhandled Http404, PermissionDenied in schema generation (#4645) (#4646) 2016-11-02 09:04:01 +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
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
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
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
Tom Christie
de08f28a91 Test one to one with inheritance (#4575) 2016-10-13 14:21:23 +01: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
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
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
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
Alex Kahan
4ff9e96b4c Adding tests to encoder.py (#4536) 2016-10-05 09:54:59 +01:00
Alex Kahan
915ac22aeb Adding tests for rest_framework.py (#4523) 2016-10-04 21:22:56 +01:00
Rowan Seymour
883efbc19f Case insensitive uniqueness validation (#4534) 2016-10-04 13:44:50 +01:00
Tom Christie
be74d11165 Fallback behavior for request parsing when request.POST already accessed. (#4500) 2016-09-21 11:49:09 +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
Mathieu Pillard
07efbdb45e Fix APIClient.get() when path contains unicode arguments (#4458) 2016-09-02 17:00:03 +01:00
José Padilla
d0ed482d70 Skip HiddenField from Schema fields (#4429) 2016-08-22 16:53:53 +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
Neil Parsons
7466b61e62 Don't strip empty query params when paginating (#4260) 2016-08-12 10:50:16 +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
Tom Christie
9857cd9889 Add failing test for issue #3868 (#4378) 2016-08-10 16:04: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
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
Dmitry Dygalo
e1768bdc16 Fixed various typos (#4366) 2016-08-08 09:32:22 +01:00
Tom Christie
d5178c9246 Include kwargs passed to 'as_view' when generating schemas (#4359) 2016-08-05 11:19:39 +01:00
Tom Christie
a9a097496e extra_kwargs takes precedence over uniqueness kwargs (#4349) 2016-08-02 14:33:15 +01:00
Tom Christie
5500b265bc Test cases for DictField with allow_null options (#4348) 2016-08-02 14:14:36 +01:00
Tom Christie
bda16a518a Dedent tabs. (#4347) 2016-08-02 13:33:14 +01:00
Tom Christie
e37619f741 Serializer defaults should not be included in partial updates. (#4346)
Serializer default values should not be included in partial updates
2016-08-02 13:05:12 +01:00
Tom Christie
3ef3fee926 Descriptive error from FileUploadParser when filename not included. (#4340)
* Descriptive error from FileUploadParser when filename not included.
* Consistent handling of upload filenames
2016-08-01 18:44:58 +01:00
Tom Christie
46a44e52aa Quantize incoming digitals (#4339) 2016-08-01 17:15:41 +01:00
Tom Christie
aa349fe767 Handle non-string input for IP fields (#4338) 2016-08-01 16:14:26 +01:00
Alexander Gaevsky
46a870c002 Fix schema generation for APIView, since it does not have get_serializer_class method. (#4285) 2016-07-27 15:36:36 +01:00
Tom Christie
351e0a4a99 Fix json indent parameter. Closes #4281 (#4313) 2016-07-27 11:49:01 +01:00