Commit Graph

6934 Commits

Author SHA1 Message Date
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
Josep Cugat
46f837a9d1 Fix APIException full_details() typo in documentation (#4633)
APIException has a get_full_details() method but the documentation refers to full_details().
2016-10-28 12:05:32 +01:00
Ryan P Kilby
eafc9a2393 Fix is_simple_callable with variable args, kwargs (#4622) 2016-10-25 20:47:24 +01:00
José Padilla
1bd35ad355 Merge pull request #4617 from tuffnatty/docs-pagination-add-drf-proxy-pagination
Add `drf-proxy-pagination` reference to Pagination docs
2016-10-23 09:46:57 -04:00
Phil Krylov
72dc6d1d5c Add drf-proxy-pagination reference to Pagination docs 2016-10-23 04:36:36 +03:00
Mads Jensen
8ac524915c added on_delete=models.CASCADE to models.ForeignKey in the documentation (#4614) 2016-10-22 16:37:23 +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
d647d37a99 Fix Accept header in tutorial. Closes #4604. [ci skip] 2016-10-21 15:45:28 +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
856f086ce3 Remove broken wheel check in setup.py [ci skip] 2016-10-21 14:42:42 +01:00
Maxime Lorant
1aa6dff0b5 Fix code formatting missing in 3.5 announcement (#4597)
... in section ModelSerializer 'fields' and 'exclude'
2016-10-20 16:47:59 +01:00
Tom Christie
c6f1686571 Remove erronous file [ci skip] 2016-10-20 16:26:56 +01:00
Tom Christie
3b9afb571b Version 3.5.0 (#4596) 2016-10-20 16:25:40 +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
3f6004c5a9 Use pk for URL conf and views. (#4592) 2016-10-20 09:42:40 +01:00
Xavier Ordoquy
f9cf237e0b Merge pull request #4590 from zwernberg/patch-1
Fixed minor sentence in Filter.py filter_queryset() Comment
2016-10-19 09:01:42 +02:00
Zach Wernberg
fcff16c5c6 minor typo 2016-10-18 23:14:55 -05:00
Fa773N M0nK
d5e63d2d7f Reflect that '@detail_route' responds to GET only by default. (#4582) 2016-10-18 11:06:04 +01:00
Alex Poleha
a83997e1ed Removed incorrect line from generic-views.md (#4583) 2016-10-14 11:29:48 +01:00
Akshay Sharma
cca9792ae7 contributing.md django fix. (#4581)
* installation for django added in requirements.txt
* added line to install django first in contributing.md

* added line to install django first in contributing.md and CONTRIBUTING.md
2016-10-14 11:20: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
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
4c9b14bd97 Add --minimum-perc to transifex pull command [ci skip] 2016-10-12 10:13:46 +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
Xavier Ordoquy
5f6ceee7a5 Merge pull request #4552 from duoi/master
Corrected `artist` and `album_name` typo in docs
2016-10-11 07:55:37 +02:00
Steven Johns
072d14c2e1 Corrected artist and album_name
`The Roots` are the band: https://en.wikipedia.org/wiki/The_Roots

`Undun` is their album: https://en.wikipedia.org/wiki/Undun
2016-10-11 11:20:48 +11: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
Manjit Kumar
d49e26f127 add drf-url-filters in third party filtering resources and fixed typo (#4548) 2016-10-10 12:35:38 +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
Alex Kahan
4ff9e96b4c Adding tests to encoder.py (#4536) 2016-10-05 09:54:59 +01:00