Jon Dufresne
ed6340ee76
Remove unnecessary use of compat shim six.binary_type ( #6189 )
...
The type bytes is available on all supported Pythons. On Python 2.7, it
is an alias for str, same as six.binary_type. Makes the code more
forward compatible with Python 3.
2018-09-17 10:39:59 +02:00
Ryan P Kilby
fc6cbb5b26
Allow nullable BooleanField in Django 2.1 ( #6183 )
...
* Add tests for BooleanField when nullable
* Allow nullable BooleanField in Django 2.1
* Drop 'BooleanField.allow_null' check
* Remove conflicting false/null values
2018-09-13 17:25:03 +01:00
Jerome Leclanche
612a7b989f
Fix Python 3.8 compatibility ( #6154 )
2018-09-10 21:12:32 -07:00
Jon Dufresne
4d57d46bf8
Prefer io.BytesIO over six; available on all supported Pythons ( #6168 )
...
On all supported Pythons, the io.BytesIO is always a stream
implementation using an in-memory bytes buffer.
Makes code slightly more forward compatible by reducing use of the six
module and promotes more forward compatible practices in the docs.
2018-09-09 11:53:41 +01:00
oliver
bcc565f387
Clean up unnecessary if statement ( #6163 )
2018-09-06 07:25:20 +01:00
Jon Dufresne
468cdd16ed
Remove unnecessary models.py file ( #6142 )
...
Since Django 1.7, an empty models.py file is not required.
See
https://docs.djangoproject.com/en/dev/releases/1.7/#app-loading-refactor
> It is possible to omit models.py entirely if an application doesn’t
> have any models.
2018-08-28 09:51:28 +02:00
Craig de Stigter
81fa4b4f75
Fix CSRF cookie check failure when using session auth with django 1.11.6+ ( #6113 )
...
Test included. Fixes #6088
2018-08-07 08:18:56 +01:00
Oleg
2fab7838ef
Improve ModelSerializer.create() error message. ( #6112 )
2018-08-06 20:11:55 +02:00
Oleg
8b5e830bce
Handle models without .objects manager in ModelSerializer. ( #6111 )
...
* Handle models without .objects manager in ModelSerializer.
* Improvements according to review comments.
2018-08-06 14:30:43 +02:00
Ryan P Kilby
38b3d0109b
Only catch TypeError/ValueError for object lookups ( #6028 )
...
* Only catch TypeError/ValueError for object lookups
* Test wrapped TypeError/ValueError handling
* Raise NotImplementedError in tests instead of pass
2018-07-06 12:18:17 +02:00
Ryan P Kilby
a628a2dbce
Drop Django 1.10 support ( #5657 )
...
* Remove Django 1.10 from CI
* Remove Django 1.10 compat code
2018-07-06 12:14:31 +02:00
Ryan P Kilby
9b8af04e7f
Move guardian imports out of compat ( #6054 )
2018-07-06 11:32:02 +02:00
Ryan P Kilby
7095021db7
Rename base_name => basename for consistency's sake ( #5990 )
...
* Rename base_name => basename for consistency
* Update tests to use basename
2018-07-06 11:03:12 +02:00
Ryan P Kilby
f89cc066bc
Admin renderer urls ( #5988 )
...
* Make admin detail link have small width
* Disable admin detail link when no URL
* Add 'AdminRenderer.get_result_url'
Attempts to reverse the result's detail view URL.
2018-07-06 10:58:26 +02:00
Daniel Hahler
3578bd6883
get_error_detail: use error_dict/error_list ( #5785 )
2018-07-06 10:44:58 +02:00
Ryan P Kilby
6511b52cca
Fix schemas for extra actions ( #5992 )
...
* Add failing test for extra action schemas
* Add ViewInspector setter to store instances
* Fix schema disabling for extra actions
* Add docs note about disabling schemas for actions
2018-07-06 10:35:36 +02:00
Ryan P Kilby
0148a9f8da
Improvements to ViewSet extra actions ( #5605 )
...
* View suffix already set by initializer
* Add 'name' and 'description' attributes to ViewSet
ViewSets may now provide their `name` and `description` attributes
directly, instead of relying on view introspection to derive them.
These attributes may also be provided with the view's initkwargs.
The ViewSet `name` and `suffix` initkwargs are mutually exclusive.
The `action` decorator now provides the `name` and `description` to
the view's initkwargs. By default, these values are derived from the
method name and its docstring. The `name` may be overridden by providing
it as an argument to the decorator.
The `get_view_name` and `get_view_description` hooks now provide the
view instance to the handler, instead of the view class. The default
implementations of these handlers now respect the `name`/`description`.
* Add 'extra actions' to ViewSet & browsable APIs
* Update simple router tests
Removed old test logic around link/action decorators from `v2.3`. Also
simplified the test by making the results explicit instead of computed.
* Add method mapping to ViewSet actions
* Document extra action method mapping
2018-07-06 10:33:10 +02:00
Eduardo GP
ff4429fad4
fix e.indexOf is not a function error ( #5982 )
2018-05-11 21:49:29 +01:00
Craig de Stigter
9629886915
Fixed AttributeError from items filter when value is None ( #5981 )
2018-05-11 08:50:08 +02:00
Ryan O’Hara
a11938ce96
Fixed instance being overwritten in pk-only optimization try/except block ( #5747 )
2018-04-24 16:15:38 +02:00
Noam
7268643b25
min_value/max_value support in DurationField ( #5643 )
...
* Added min_value/max_value field arguments to DurationField.
* Made field mapping use mix/max kwargs for DurationField validators.
2018-04-24 09:24:05 +02:00
Sascha P
7d64b7016d
Removed input value from deault_error_message ( #5881 )
2018-04-20 16:00:27 +02:00
Jimmy Merrild Krag
4260531b6c
Render descriptions (from help_text) using safe ( #5869 )
...
To allow embedded HTML, and make consistent with other usages.
Fixes #5715 .
2018-04-20 15:51:27 +02:00
Jimmy Merrild Krag
5ee0e5df83
Correct schema parsing for JSONField ( #5878 )
...
Fixes #5873 .
* Use Object type.
* Add test for field_to_schema
2018-04-20 15:47:20 +02:00
Craig Anderson
2ebd479759
Allow hashing of ErrorDetail to fix #5919 ( #5932 )
2018-04-20 15:32:37 +02:00
Christian Kreuzberger
f148e4e259
Ensure that html forms (multipart form data) respect optional fields ( #5927 )
2018-04-20 15:11:52 +02:00
Tom Christie
7e705246ca
Ensure docs sidebar can scroll to bottom. ( #5949 )
...
Closes #5948
2018-04-20 12:11:48 +01:00
Ryan P Kilby
7078afa42c
Change ISO 8601 date format to exclude year/month ( #5936 )
2018-04-14 05:23:31 +01:00
Carlton Gibson
fb802c0910
Update version and notes for 3.8.2 release. ( #5923 )
2018-04-06 15:41:11 +02:00
Carlton Gibson
42eb5a4342
Fix read_only + default unique_together validation. ( #5922 )
...
* Add test for read_only + default unique_together validation.
* Fix read_only + default validation
2018-04-06 15:20:54 +02:00
gsvr
32caca4dd3
Import coreapi from rest_framework.compat, not directly. ( #5921 )
2018-04-05 15:07:49 +02:00
Carlton Gibson
bc353452f4
Bump version and release notes for 3.8.1 ( #5916 )
2018-04-04 21:10:34 +02:00
Ryan P Kilby
cba426b34c
Use old url_name behavior in route decorators ( #5915 )
...
* Wrap action decorator for old url_name behavior
2018-04-04 20:50:42 +02:00
Carlton Gibson
fc588f539b
Version 3.8 Release ( #5769 )
2018-04-03 15:35:26 +02:00
Carlton Gibson
1befab795a
Added generic 500 and 400 JSON error handlers. ( #5904 )
...
* Added generic 500 and 400 JSON error handlers.
* Docs for generic error views.
2018-04-03 09:16:36 +02:00
Andrew Tallos
36119cad31
Enable OrderingFilter to handle an empty tuple (or list) for the 'ordering' field. ( #5899 )
2018-03-26 12:22:45 +01:00
Craig de Stigter
a5072778e9
Don't show hidden fields in metadata ( #5854 )
...
HiddenField is meant to be hidden, but we discovered it showing up in OPTIONS requests
2018-03-23 22:47:10 +00:00
Charlie McBride
a7e2a7bfcd
Add LimitOffsetPagination.get_count to allow method override ( #5846 )
...
* Add LimitOffsetPagination.get_count to allow method override
* Format method docstring
2018-03-23 22:25:43 +00:00
George-Cristian Bîrzan
85c588b0c1
#5848 Allow traversing nullable related fields ( #5849 )
2018-03-20 22:02:22 +01:00
Carlton Gibson
6c0c69ed65
Correct allow_null behaviour when required=False ( #5888 )
...
* Revert "Non-required fields with 'allow_null=True' should not imply a default value (#5639 )"
This reverts commit 905a5579df
.
Closes #5708
* Add test for allow_null + required=False
Ref #5708 : allow_null should imply default=None, even for non-required fields.
* Re-order allow_null and default in field docs
default is prior to allow_null. allow_null implies an outgoing default=None.
* Adjust allow_null note.
2018-03-20 21:24:39 +01:00
Carlton Gibson
c2b24f83a3
Alter read_only+default behaviour ( #5886 )
...
* Always exclude read_only fields from _writable_fields
* Remove `read_only` from `CreateOnlyDefault` example.
In this context (without mentioning `save`) now slightly misleading.
2018-03-20 21:09:31 +01:00
gthieleb
9e08a7cbec
Fixed schema for UUIDField in SimpleMetadata. ( #5872 )
...
* fix schema for UUIDField
* Add unit test for d4c8f2db
2018-03-13 15:49:15 +01:00
Oliver Newman
d2994e0596
Fix comment typo in ModelSerializer ( #5844 )
2018-02-21 16:39:53 +01:00
Carlton Gibson
e34fd995cd
Made TemplateHTMLRenderer render IntegerField inputs when value is 0
. ( #5834 )
...
* Fix 0 value IntegerField in TemplateHTMLRenderer
Signed-off-by: Nikhil Sheoran <nikhilsheoran96@gmail.com>
* Remove unnecessary `field.value != “”` check
* Adjust test case
Uses `vertical` templates only.
2018-02-16 16:48:20 +01:00
Carlton Gibson
da535d31dd
Fixed active timezone handling for non ISO8601 datetimes. ( #5833 )
...
* Add failing test for to_representation with explicit default timezone
See discussion here:
https://github.com/encode/django-rest-framework/pull/5435#issuecomment-364054509
* Always run enforce_timezone
2018-02-16 16:47:49 +01:00
Daniel Hahler
2854679f56
Upgrade isort ( #5817 )
...
* Fix isort
* runtests: add --diff to ISORT_ARGS
* requirements-codestyle: bump isort to 4.3.3
* isort: move config to setup.cfg
2018-02-14 20:12:14 +00:00
Kent Kawashima
d82b332a09
Changes ternary conditionals to be PEP308 compliant ( #5827 )
2018-02-14 14:06:09 +00:00
Carlton Gibson
7d0d22ffaa
Use single copy of static assets. Update jQuery ( #5823 )
...
* Move font-awesome to top level.
* Use top-level jQuery & Bootstrap
* Update to jQuery v3.3.1
Compatible with Bootstrap v3.3.7
c.f. https://github.com/twbs/bootstrap/issues/16834#issuecomment-251996660
* Re-add bootstrap-theme
2018-02-12 14:14:44 +00:00
Ryan P Kilby
1bc826e6fd
Fix authtoken views imports ( #5818 )
2018-02-07 14:46:17 -05:00
Ryan P Kilby
c456b3c510
Fix request formdata handling ( #5800 )
...
* Rename 'wsgi' request test to more accurate 'http'
* Test duplicate request stream parsing
* Fix setting post/files on the underlying request
2018-02-05 16:24:13 +01:00