Commit Graph

575 Commits

Author SHA1 Message Date
Asif Saifuddin Auvi
3db45cb94d removed description codes as it seems to be python 2.6 issue 2016-06-01 00:39:01 +06:00
Kennedy Mwenja
592eea9b9e * Use get_serializer_class in ordering filter* Test improper configuration of ordering* Raise ImproperlyConfigured when missing get_serializer_class
* Use get_serializer_class in ordering filter
* Test improper configuration of ordering
* Raise ImproperlyConfigured when missing get_serializer_class
2016-05-26 09:59:13 +01:00
Xiao Hanyu
19bdfda49a Fix #3844, refine validator for fields with <source=> kwargs
When serializers has fields with something like `source=user.email`, the
uniqueness validator should check `email` field instead of `user`, cause
`user` is a model object.
2016-05-26 10:58:37 +08:00
Tom Christie
ebb4070467 Resolve TimeField representation for midnight value. (#4107) 2016-05-10 11:56:36 +01:00
José Padilla
0795f7394c Prevent raising exception when limit is 0 (#4098) 2016-05-10 10:58:24 +01:00
Miro Hrončok
ffdac0d936 TokenAuthentication: Allow custom keyword in the header (#4097)
This allows subclassing TokenAuthentication and setting custom keyword,
thus allowing the Authorization header to be for example:

    Bearer 956e252a-513c-48c5-92dd-bfddc364e812

It doesn't change the behavior of TokenAuthentication itself,
it simply allows to reuse the logic of TokenAuthentication without
the need of copy pasting the class and changing one hardcoded string.

Related: #4080
2016-05-04 10:53:34 +01:00
Germán Larraín
e19b21ecc5 Handle incorrectly padded HTTP basic auth header (#4090) 2016-05-03 09:24:55 +01:00
Daniele Varrazzo
88c80fe2e9 Fixed DecimalField arbitrary precision support (#4075) 2016-04-27 17:04:01 +01:00
Xavier Ordoquy
1823662e1e Merge pull request #4044 from linovia/merge/3.3.x_to_master
Merge the changes in 3.3.x back to master.
2016-04-21 11:31:15 +02:00
Phivos Stylianides
08dad04b19 Fix warnings when running tests (#4047) 2016-04-11 14:13:11 +01:00
Simon Charette
d87f2bc7b6 OrderingFilter adjustements (#3983)
* Made sure the OrderingFilter relies on Field.verbose_name.

* Marked OrderingFilter's order labels for translation.
2016-04-08 15:37:23 +01:00
Xavier Ordoquy
bff3bebdbe Merge remote-tracking branch 'reference/stable/3.3.x' into merge_test
# Conflicts:
#	docs/topics/release-notes.md
2016-04-08 15:46:17 +02:00
Jonathan Liuti
78e4ea0d6e No auth view failing permission should raise 403
A view with no `authentication_classes` set and that fails a

permission check should raise a 403 with the message from the

failing permission.
2016-04-07 16:24:26 +01:00
Xavier Ordoquy
cfb77ae6fa Merge pull request #3273 from olliewalsh/breadcrumbs_view_name
Do not ignore overridden View.get_view_name() in breadcrumbs
2016-03-23 01:10:13 +01:00
Xavier Ordoquy
0e8306341d Merge pull request #3936 from carltongibson/null-uuid-fk-take2
Fix None UUID ForeignKey serialization
2016-03-22 22:46:33 +01:00
Jared Lang
e34a34e90b Fix empty pk detection in HyperlinkRelatedField.get_url
This implementation allows detection of empty values that are non-nullable, allowing the field to return None values for such cases
2016-03-07 19:37:48 +01:00
Jared Lang
7ac8cc760c Fix empty pk detection in HyperlinkRelatedField.get_url
This implementation allows detection of empty values that are non-nullable, allowing the field to return None values for such cases
2016-02-29 12:56:56 -08:00
José Padilla
69c0de4faa Merge pull request #3953 from akarambir/remove-old-django-checks
Closes #3952: Remove old django checks from tests and compat
2016-02-19 11:08:45 -04:00
Karambir Singh Nain
69f1e3a9fd Remove old django checks from tests and compat
Remove skipping of tests for Django<1.8. Remove several functions from compat.py not needed for Django>=1.8
2016-02-19 01:47:45 +05:30
Xavier Ordoquy
5e08231453 Remove informations about why the pagination didn't work.
We remove a couple of informations to lower the exposition of our internals.
2016-02-17 18:18:19 +01:00
Erick Wilder
8109752061 Closes #3937. Support callable as the value of initial for any serializer.Field 2016-02-17 10:52:21 +01:00
Carlton Gibson
cbb8d8d254 Test deserialising data including None fk 2016-02-16 09:38:42 +01:00
Carlton Gibson
20d1fdba69 Fix None UUID ForeignKey serialization 2016-02-16 09:29:48 +01:00
Kostya Esmukov
b6adfab9b2 Added test case for #3908 2016-02-07 19:26:37 +03:00
Mikalay Radchuk
714607307e Fixes AttributeError in HTMLFormRenderer.render
If `HTMLFormRenderer.render` will be called with default arguments,
`AttributeError: 'NoneType' object has no attribute 'get'` will be raised.
2016-01-26 21:26:30 +03:00
Xavier Ordoquy
5068ecf64b Rename the get_queryset overriding test. 2016-01-21 16:50:07 +01:00
Xavier Ordoquy
6d95da7b2d Improve the get_queryset overriding test readability. 2016-01-21 16:48:32 +01:00
Xavier Ordoquy
f1b28b4d63 Merge pull request #3605 from ryanhiebert/slug-related-field-queryset
RelatedField get_queryset and context
2016-01-20 18:17:29 +01:00
Mads Jensen
215e1b6c6b Regarding #3729
python -Werror generates warnings informing that on_delete is a required keyword in Django 2.0
2016-01-14 15:14:33 +01:00
areski
4e01796303 Test for TimeField not handling empty values 2016-01-11 12:16:26 +01:00
Mikalai Radchuk
6b207d93d6 DateField.to_representation unicode compatibility 2016-01-11 13:11:01 +03:00
Tom Christie
f01a3d9c36 Merge pull request #3801 from koordinates/fix-nested-validation-error
Fix nested validation error being rendered incorrectly.
2016-01-07 09:22:23 +00:00
Kevin Massey
7cd3933144 Fixes #3804, avoiding update of Meta.extra_kwargs
Added unit test to cover.
2016-01-06 15:04:51 -05:00
Craig de Stigter
651319e2da Fix nested validation error being rendered incorrectly.
Previously an extra list wrapped nested validation errors raised from serializer's validate() methods.
That was inconsistent with the format of validation errors raised by validate_<fieldname> methods.
i.e. these two resulted in *different* behaviour:

    def validate_foo(self):
        raise ValidationError(['bar'])

    def validate(self):
        raise ValidationError({'foo': ['bar']})
2016-01-06 16:05:43 +13:00
Tom Christie
37f7b76f72 Merge pull request #3785 from sheppard/authtoken-import
don't import authtoken model until needed
2016-01-05 17:28:48 +00:00
S. Andrew Sheppard
4f40714169 fix import order 2016-01-05 10:20:22 -06:00
S. Andrew Sheppard
2b8c036b48 test custom token model 2016-01-05 09:58:16 -06:00
S. Andrew Sheppard
1712c00001 update invalid token case 2016-01-05 09:42:22 -06:00
Kevin Brown
a772326112 Merged two DecimalValidator tests together
These two tests were previously added in
7d79cf35b7
but we have now discovered that there are not actually two separate
cases, there was just a  bug in the code that made it look that way.

This also removes a redundant check to see if `DecimalValidator` was
defined.
2016-01-04 10:22:17 -05:00
Kevin Brown
d797389cf7 Fixed broken test for Django < 1.9
This test was incorrectly checking that there were no validators set in
older versions of Django, even though it should have been checking for
the two validators that were set up on the model field level.

The originally regression test that this fixes was added in
7d79cf35b7
when fixing an issue with the `DecimalValidator`.
2015-12-24 18:17:58 -05:00
Kevin Brown
9bab640b0a Added tests for min_value and max_value on a DecimalField
This adds tests for a regression where the `min_value` and `max_value`
arguments are not being set for a DRF `DecimalField` even though the
corresponding `MinValueValidator` and `MaxValueValidator` is being set
on the model fields.

Note that this only appears to be a regression for Django < 1.9, as
these regression tests pass on newer versions of Django.
2015-12-24 14:00:49 -05:00
Tom Christie
18cdfcd712 Merge pull request #3731 from mjparker777/master
Issue 3726 DateTimeField not handling empty values
2015-12-18 11:27:12 +00:00
Luis San Pablo
c389aeb051 Lint import ordring 2015-12-16 18:46:23 -06:00
Luis San Pablo
62e2a9706f Fixed import order settings 2015-12-16 18:37:50 -06:00
Luis San Pablo
dab6bf4b1a Changed error to warning message 2015-12-16 18:35:02 -06:00
mjparker777
fc08236ab8 updated timefield also 2015-12-13 16:09:56 -07:00
mjparker777
81775dfbae added missing comma 2015-12-13 12:27:08 -07:00
mjparker777
bf60c08010 Issue 3726 DateTimeField not handling empty values 2015-12-13 12:21:13 -07:00
Luis San Pablo
9db4c2ae8a --ammend 2015-12-07 22:31:09 -06:00
Luis San Pablo
4e5c57ab46 type on test case 2015-12-07 22:19:58 -06:00
Luis San Pablo
03c7f149ac Test case for settings check 2015-12-07 22:17:33 -06:00
Luis San Pablo
4b59681c60 Fixed Class Newlines 2015-12-04 05:57:09 +00:00
Luis San Pablo
4092cef392 Fixed Test Case for Hyperlink 2015-12-04 05:42:46 +00:00
Luis San Pablo
8501f59216 Hyperlink Test Case 2015-12-04 05:30:39 +00:00
bphillips
c153bcb479 Added validation to UUIDField to properly catch invalid input types (lists, tuples, etc). 2015-12-01 14:09:10 -05:00
Tom Christie
832d6322a7 Merge pull request #3631 from syphar/paginat
allow setting a custom Django Paginator class
2015-11-30 20:58:32 +00:00
Petros Moisiadis
3594c976b7 Added test case for rendering nested fields with none value 2015-11-27 15:07:29 +02:00
Tom Christie
04158e187e Merge pull request #3513 from pattisdr/feature/ListField_needs_to_enforce_list
ListField does not enforce that input is a list
2015-11-18 12:19:40 +00:00
Dawn Pattison
3ddbf92bf9 Remove unicode from exception value. 2015-11-13 10:41:57 -05:00
Dawn Pattison
5fdc4f22cf Add tests to ensure ListField does not except dictionary as input. 2015-11-13 10:17:09 -05:00
Denis Cornehl
3806af3d15 allow setting a custom Django Paginator in pagination.PageNumberPagination 2015-11-13 16:04:12 +01:00
Xavier Ordoquy
795cf4716d Fix module name with Python 3.5 2015-11-11 17:44:46 +01:00
Ryan Hiebert
f2452936e9 Allow no queryset when get_queryset overridden
The user may wish to provide a dynamic queryset on a `RelatedField`
based on the `context`. The way to do that is to create a subclass of
`RelatedField` (or a child) and override the `get_queryset` method.
However, this is undocumented, and instantiating that field without a
`queryset` argument (because it's not needed) will raise an assertion
error.

Document `.get_queryset(self)` as an official part of the API of
`RelatedField`, and don't enforce the use of `queryset` when
`get_queryset` is overridden.
2015-11-05 17:34:02 -06:00
José Padilla
7d79cf35b7 Add regression test for DecimalField mapping 2015-10-30 07:47:11 -04:00
Matthew Madurski
8aed3d4862 Correctly handle false in nested as_form_field 2015-10-24 19:48:17 -04:00
Tom Christie
84e9013417 Merge pull request #3531 from tomchristie/version-3.3
Version 3.3
2015-10-23 16:24:08 +01:00
José Padilla
d64bfef56a Map all supported FilePathField options 2015-10-23 10:08:29 -04:00
Tom Christie
7bfc420dc9 Add release notes, drop deprecated test 2015-10-22 15:11:10 +01:00
José Padilla
a1dad503cf Map TextField max_length to CharField 2015-10-16 07:17:33 -04:00
Tom Christie
dad207de66 Don't attempt to test dicts (unordered) 2015-09-28 17:41:09 +01:00
Tom Christie
ec8098b7e2 Work around 2.x/3.x json.dumps() return type fuzziness 2015-09-28 17:32:36 +01:00
Tom Christie
10dbf1316f Added JSONField. Closes #3170. 2015-09-28 17:25:52 +01:00
Tom Christie
c64896c849 More cleanup of browser overrides 2015-09-28 15:33:55 +01:00
Tom Christie
d7142e23ac Merge branch 'master' into remove-content-overriding 2015-09-28 15:15:50 +01:00
Tom Christie
2d0b54e263 Merge branch 'drop-django-16' oft https://github.com/carltongibson/django-rest-framework into carltongibson-drop-django-16
Conflicts:
	docs/topics/release-notes.md
2015-09-28 11:17:48 +01:00
Tom Christie
ca8313aeac Merge branch 'master' into version-3.3
Conflicts:
	docs/topics/release-notes.md
2015-09-28 10:57:14 +01:00
Stian Jensen
62c000bc12 Use model error_messages when available
In the automatically applied UniqueValidator, use the error message from
error_messages defined in the model instead of the generic default
UniqueValidator message.

This fixes #2878.
2015-09-23 15:20:44 +02:00
paolopaolopaolo
7640bfea9e Add assert statement to .save() method in Serializer:
- Asserts that `_data` does not exist when calling `.save()`
2015-09-22 11:49:51 -07:00
paolopaolopaolo
134f5fa4bc Fixes #3265 (now with Test Case)
- Added test_data_access_before_save_raises_error test
2015-09-22 11:40:19 -07:00
Carlton Gibson
45ace5010e Remove OrderedDict fallback 2015-09-22 16:35:38 +02:00
Carlton Gibson
0b34408172 Remove unittest.skipUnless 2015-09-22 16:24:22 +02:00
Carlton Gibson
6e86a53c92 Remove apps.get_model fallback
* Corrects presumed logic error in `ResolveModelWithPatchedDjangoTests`
2015-09-22 16:14:45 +02:00
Carlton Gibson
68c88e180f Remove ContentType import fallback 2015-09-22 15:55:39 +02:00
Alexey Boriskin
0155a44aac Typo in test method name 2015-09-22 12:13:01 +03:00
Carlton Gibson
25de8c960f Remove Django 1.5 get_model_name fallback 2015-09-21 20:10:31 +02:00
Xavier Ordoquy
f2c65512c6 Merge pull request #3415 from adamsc64/issue_2761
Fixed #2761 - ListField truncation on HTTP PATCH
2015-09-21 13:06:44 +02:00
Christopher Adams
cb42b995fa Proof of bug #2761
- When not submitting key for list fields or multiple choice, partial
  serialization should result in empty state (key not there), not an
  empty list.
2015-09-19 10:17:57 -04:00
Tom Christie
b8ebe29844 Import sorting 2015-09-17 16:40:47 +01:00
Tom Christie
343fd5ec3d Merge branch 'canassa-method-not-allowed-not-raised' into remove-content-overriding 2015-09-17 16:39:30 +01:00
Tom Christie
66e372200f Merge branch 'method-not-allowed-not-raised' of https://github.com/canassa/django-rest-framework into canassa-method-not-allowed-not-raised 2015-09-17 16:38:42 +01:00
Tom Christie
4b4130e8b2 Fix request cloning, so method becomes set 2015-09-17 16:34:03 +01:00
Tom Christie
a3067bea55 Merge branch 'master' into version-3.3 2015-09-17 16:24:46 +01:00
Tom Christie
566812ac0b Remove method and content overriding 2015-09-17 15:17:29 +01:00
Steven Loria
284f9faa07 Correctly handle [] and {} as invalid inputs to BooleanField 2015-09-11 23:12:18 -04:00
Xavier Ordoquy
aa48182686 Add test coverage on allow_empty for nested serializers. 2015-09-07 23:11:01 +02:00
raphaelmerx
b9782b6850 DurationField accepts integers 2015-09-02 16:47:50 -07:00
Tom Christie
f87573ffa3 Merge pull request #3345 from jpadilla/fields
Update ModelSerializer 'fields'/'exclude'/'__all__' behavior
2015-08-28 14:57:05 +01:00
Tom Christie
7560e8381f Drop unused patterns 2015-08-28 10:53:44 +01:00
Tom Christie
6fa534f214 Fix urlpatterns in test 2015-08-28 10:44:49 +01:00
Tom Christie
25c4c7f9fd Pep8 fix 2015-08-28 10:03:16 +01:00