Ryan P Kilby
1a170438d2
Add "optionals not required" build ( #6047 )
2018-06-22 10:16:57 +02:00
Daniel Hahler
a44cb67988
tests: fix usage of transaction.non_atomic_requests ( #6043 )
2018-06-21 14:44:58 -04:00
Craig de Stigter
9629886915
Fixed AttributeError from items filter when value is None ( #5981 )
2018-05-11 08:50:08 +02:00
Daniel Hahler
275c157341
tests: remove some dead code, use assert 0
for never called methods ( #5973 )
...
* tests: remove some dead code, use `assert 0` for never called methods
* fixup! tests: remove some dead code, use `assert 0` for never called methods
2018-05-08 13:28:46 +01:00
Daniel Hahler
fca39f9dbb
tests: fix test_write_only_fields not being executed ( #5971 )
...
This adds the required `test_` prefix.
2018-05-08 09:27:35 +01:00
Daniel Hahler
e79610af3a
tests: fix skipping with TestPosgresFieldsMapping ( #5965 )
...
`pytest.mark.skipUnless` does not exist, it was confused with
`unittest.skipUnless` probably.
2018-05-03 13:31:46 +01: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
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
Ryan P Kilby
7078afa42c
Change ISO 8601 date format to exclude year/month ( #5936 )
2018-04-14 05:23:31 +01: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
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
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
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
Carlton Gibson
247cf096d4
Test using model objects for dotted source default ( #5880 )
...
… when path components may be null.
Ref #5375 , #5727
2018-03-16 14:51:37 +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
Chandrakant Gopalan
20f1203aac
Add admin to installed apps to avoid test failures.
...
The tests look for the "admin" app in the list of apps. If not present, running `runtests.py` gives the following error:
```
LookupError: No installed app with label 'admin'.
```
Adding admin to `INSTALLED_APPS` fixes it.
2018-03-09 13:04:15 -05: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
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
Jeremy Lainé
a8d129b7da
Represent serializer DictField as an Object in schema
...
DictFields were incorrectly being output as String in the schema.
This pull request outputs an Object instead and adds a unit test.
Update s/detail_route/action/ after rebase
2018-02-01 16:23:24 +01:00
Jeremy Lainé
27f32faee4
Fix schema generation for PrimaryKeyRelatedField ( #5764 )
...
By default all subclasses of RelatedField are output as string fields in
the schema, which works well for StringRelatedField, SlugRelatedField or
HyperlinkedRelatedField.
Handle the common case of a PrimaryKeyRelatedField pointing to an
AutoField.
2018-02-01 16:14:35 +01:00
Daniel Hahler
769bc1336f
ErrorDetail: add __eq__/__ne__ and __repr__ ( #5787 )
...
This adds `__eq__` to handle `code` in comparisons.
When comparing an ErrorDetail to a string (missing `code` there) the
ErrorDetail's `code` is ignored, but otherwise it is taken into account.
2018-01-30 08:45:09 +01:00
Ryan P Kilby
73203e6b59
Rework dynamic list/detail actions ( #5705 )
...
* Merge list/detail route decorators into 'action'
* Merge dynamic routes, add 'detail' attribute
* Add 'ViewSet.get_extra_actions()'
* Refactor dynamic route checking & collection
* Refactor dynamic route generation
* Add 'ViewSet.detail' initkwarg
* Fixup schema test
* Add release notes for dynamic action changes
* Replace list/detail route decorators in tests
* Convert tabs to spaces in router docs
* Update docs
* Make 'detail' a required argument of 'action'
* Improve router docs
2018-01-25 09:40:49 +01:00
Ryan P Kilby
2709de1310
Add HStoreField, postgres fields tests ( #5654 )
...
* Test postgres field mapping
* Add HStoreField
* Ensure 'HStoreField' child is a 'CharField'
* Add HStoreField docs
2018-01-15 15:52:30 +01:00
Jon Dufresne
ffe3dbb1b1
Perfer iter(dict) over iter(dict.keys()) ( #5736 )
...
Calling dict.keys() is unnecessary. The two are functionally equivalent
on modern Pythons.
Inspired by Lennart Regebro's talk "Prehistoric Patterns in Python" from
PyCon 2017.
https://www.youtube.com/watch?v=V5-JH23Vk0I
2018-01-08 09:49:46 +00:00
Jon Dufresne
06e2ad0b7d
Remove unused compat._resolve_model() ( #5733 )
...
Last use removed in c674687782
.
2018-01-08 09:19:08 +00:00
Ryan P Kilby
68519c092f
Test staticfiles ( #5701 )
...
* Remove 'MIDDLEWARE_CLASSES' compat setting
* Remove 'django.setup()' compat import
* Move '--no-pkgroot' handling to conftest
* Add staticfiles handling to dist build
2018-01-02 11:35:56 +01:00
Ryan P Kilby
351503907c
Add exception translation test ( #5700 )
2018-01-02 11:28:45 +01:00
Ryan P Kilby
b65967711c
Formalize URLPatternsTestCase ( #5703 )
...
* Add formalized URLPatternsTestCase
* Update versioning tests w/ new URLPatternsTestCase
* Cleanup router tests urlpatterns
* Add docs for URLPatternsTestCase
2018-01-02 11:14:25 +01:00
Ryan P Kilby
6bd773e7f8
Improve composite field child errors ( #5655 )
...
* Fixup DictField test descriptions
* Nest ListField/DictField errors under the idx/key
* Add nested ListField/DictField tests
2018-01-02 10:45:59 +01:00
Cristi Vîjdea
6de12e574e
Fix format_suffix_patterns behavior with Django 2 path() routes ( #5691 )
...
* Add failing test for #5672
* Add get_original_route to complement get_regex_pattern
* [WIP] Fix path handling
* needs more tests
* maybe needs some refactoring
* Add django 2 variant for all tests and fix trailing slash bug
* Add more combinations to mixed path test
2017-12-20 13:17:54 +01:00
Tilmann Becker
d38b94fd74
Fix URL pattern parsing in schema generation ( #5689 )
...
* Fix url parsing in schema generation
- Call `str(pattern)` to get non-escaped route
- Strip converters from path to comply with uritemplate format.
Background: https://github.com/encode/django-rest-framework/issues/5675#issuecomment-352829363
Fixes #5675
2017-12-20 09:10:28 +01:00
Carlton Gibson
791539acec
Add DEFAULT_SCHEMA_CLASS setting ( #5658 )
...
* Add test for new setting
* Add DefaultSchema utility
* Add new setting to docs
2017-12-14 11:24:21 +01:00
Carlton Gibson
4a200d5e66
Fix override_settings
compat ( #5668 )
...
* Add test checking override_settings compat
* Refresh APISettings, rather than replace
Fix suggested by @daggaz https://github.com/encode/django-rest-framework/issues/2466#issuecomment-344297213
2017-12-14 10:33:48 +01:00
Ryan P Kilby
7855d3bd8b
Add '.basename' and '.reverse_action()' to ViewSet ( #5648 )
...
* Router sets 'basename' on ViewSet
* Add 'ViewSet.reverse_action()' method
* Test router setting initkwargs
2017-12-04 11:55:49 +01:00
Carlton Gibson
a0cdba6277
Extract method for manual_fields
processing ( #5633 )
...
* Extract method for `manual_fields` processing
Allows reuse of logic to replace Field instances in a field list by `Field.name`.
Adds a utility function for the logic plus a wrapper method on `AutoSchema`.
Closes #5632
* Manual fields suggestions (#2 )
* Use OrderedDict in inspectors
* Move empty check to 'update_fields()'
* Make 'update_fields()' an AutoSchema staticmethod
* Add 'AutoSchema.get_manual_fields()'
* Conform '.get_manual_fields()' to other methods
* Add test for update_fields
* Make sure `manual_fields` is a list.
(As documented to be)
* Add docs for new AutoSchema methods.
* `get_manual_fields`
* `update_fields`
* Add release notes for PR.
2017-12-04 09:07:43 +01:00
Ryan P Kilby
daba5e9ba5
Fix Serializer.data when provided invalid 'data' ( #5646 )
...
* Test serializer/API renderer for invalid datatype
* Fix Serializer.data with invalid input datatype
2017-12-04 08:39:55 +01:00
Rômulo Oliveira
905a5579df
Non-required fields with 'allow_null=True' should not imply a default value ( #5639 )
...
Ref #5518 .
2017-12-01 09:54:25 +01:00
Ryan P Kilby
5c19652080
Fix whitespace in imports
2017-11-25 21:10:30 -05:00
Ryan P Kilby
c63e35cb09
Fix AttributeError hiding on request authenticators ( #5600 )
...
* Update assertion style in user logout test
* Apply middlewares to django request object
* Fix test for request auth hiding AttributeErrors
* Re-raise/wrap auth attribute errors
* Fix test for py2k
* Add docs for WrappedAttributeError
2017-11-23 08:58:04 +01:00