David Greisen
a8711f6ab2
added *args **kwargs to field_to_native
...
only SerializerMethodField's functionality changes; it now passes
*args, **kwargs to the method in addition to the object.
we add *args, **kwargs to the rest of the fields so when people
look at the code they know if can be passed additional args.
2014-04-07 12:39:22 -04:00
David Greisen
b4f0fab043
make serializers more extensible
...
The general idea of this commit is to be able to pass metadata about
the serialization to the serializers, so the serializers can change
their behavior.
In order to do this, we must be able to (1) pass additional
parameters to the serializer at serialization time, (2) the
serializer must be able to do something with those parameters, and
(3) the serializer must be able to pass the parameters down to
child serializers.
(1) to_native now accepts *args, **kwargs
(2) we add several extension points to to_native so subclasses can
do things with the *args, **kwargs. to_native now calls _skip_field
to determine whether a given field should be skipped. A subclass
can subclass this method to skip certain fields. to_native
now calls _get_field_value to actually get a subfield's value.
_get_field_value can be subclassed to modify the *args, *kwargs
passed to a child serializer, or to modify the child field's value
based on the *args,**kwargs.
(3) to_native calls child fields with the *args, **kwargs. However
it does so in a try/except block so if it is an old field without
support for *args, **kwargs, it will not fail, it simply won't
support the *args,**kwargs functionality. field_to_native now
passes all *args, **kwargs received into to_native.
all tests pass
2014-04-07 09:44:29 -04:00
Carlton Gibson
115fe04842
Merge pull request #1501 from jacobg/patch-1
...
add a __str__ implementation to APIException
2014-04-04 16:36:41 +02:00
jacobg
6322feb32d
add a __str__ implementation to APIException
...
Add a __str__ implementation to rest_framework.exceptions.APIException. This helps for logging raised exceptions. Thanks.
2014-04-04 10:22:02 -04:00
Xavier Ordoquy
591cf8a48c
Content is a binary string.
2014-03-31 13:17:31 +02:00
Xavier Ordoquy
1c10886eba
Merge pull request #1493 from r4vi/fieldValidator-not-applied
...
add regression tests for field Validators
2014-03-31 13:12:18 +02:00
Ravi Kotecha
3560796bbf
add regression tests for field Validators
...
pep8 and add issue no
fix formatting for python 2.6 and strings for python 3.2
2014-03-31 12:10:00 +01:00
Xavier Ordoquy
73cd4e236f
Merge pull request #1477 from vlastv/patch-1
...
Writable star source with instance
2014-03-31 07:49:23 +02:00
Xavier Ordoquy
2a27674a79
Aligned the django-filter version with travis builds.
2014-03-23 15:40:42 +01:00
Xavier Ordoquy
c02c5c84fe
Merge pull request #1483 from dn0/querydict-bug
...
Fixed encoding parameter in QueryDict
2014-03-22 10:53:51 +01:00
Daniel Kontsek
3b71be725a
Fixed encoding parameter in QueryDict
2014-03-22 10:32:59 +01:00
Xavier Ordoquy
b04cd57050
Bumped tests against Django from 1.7a2 to 1.7b1
2014-03-21 16:37:27 +01:00
Tom Christie
17f0871736
Merge pull request #1469 from entrouvert/master
...
authentication: allow all transport modes of access token in OAuth2Authentication
2014-03-21 12:23:49 +00:00
Vladislav Vlastovskiy
f5fc6937ec
Change serializer name for removing confusion
2014-03-20 20:27:07 +04:00
Tom Christie
58cae22970
Merge pull request #1474 from elmehdikarami/master
...
Update serializers.py
2014-03-20 16:08:10 +00:00
Vladislav Vlastovskiy
e8167f96e6
Fixed copy-paste
2014-03-20 08:53:41 +04:00
Vladislav Vlastovskiy
c3aa10e589
Moved get component from object after test source is star
2014-03-20 01:50:40 +04:00
Vladislav Vlastovskiy
19c03f4a60
Added test writable star source
...
Uses nested serializer with parent object
2014-03-20 01:49:30 +04:00
elmkarami
499d3cb8f0
Update serializers.py
2014-03-19 17:23:15 +00:00
elmkarami
03f96988ba
Update serializers.py
...
Prevent iterating over a string that is supposed to be an iterable <==> Prevent read_only_fields = ('some_string)
2014-03-19 17:11:44 +00:00
elmkarami
5c87db96c5
Update serializers.py
...
Prevent iterating over a string that is supposed to be an iterable <==> Prevent read_only_fields = ('some_string)
2014-03-19 15:41:25 +00:00
Benjamin Dauvergne
1909472aa2
authentication: allow all transport modes of access token in OAuth2Authentication
...
RFC6750 describe three transport modes for access tokens when accessing a
protected resource:
- Auhthorization header with the Bearer authentication type
- form-encoded body parameter
- URI query parameter
This patch add support for last two transport modes.
2014-03-19 12:43:45 +01:00
Tom Christie
abe14c06f7
Minor docs tweak
2014-03-17 08:36:13 +00:00
Tom Christie
dddbff5931
Tweak DRF compound fields docs
2014-03-17 08:33:18 +00:00
Tom Christie
57b0e84bdd
Merge pull request #1472 from estebistec/ref-compound-fields
...
Serializer fields section for 3rd-party packages
2014-03-17 08:29:47 +00:00
Steven Cummings
c779dce3e4
Serializer fields section for 3rd-party packages
...
* Add new section to serializer fields page where we can list and link 3rd-party packages that provide more field types
* Add an entry for drf-compound-fields
2014-03-16 18:55:21 -05:00
Xavier Ordoquy
c44591674f
Merge pull request #1463 from linovia/bugfix/old_request_factory_url_arguments
...
Reintroduced url arguments in the urls for the tests.
2014-03-07 20:20:19 +01:00
Xavier Ordoquy
0e677e9dd1
Reintroduced url arguments in the urls for the tests.
2014-03-07 16:11:51 +01:00
Tom Christie
6cf19fa4ef
Add Django 1.7 to tox
2014-03-07 14:16:31 +00:00
Tom Christie
3fa95132d8
Don't barf if PIL is not installed.
2014-03-07 14:16:14 +00:00
Tom Christie
4001cd74ed
Pin pillow to 2.3.0
2014-03-07 14:15:56 +00:00
Tom Christie
35787fb3ca
Merge pull request #1460 from inglesp/issue1434
...
Add SEARCH_PARAM and ORDERING_PARAM to settings
2014-03-07 07:36:37 +00:00
Peter Inglesby
29f5ce7aeb
Use six to reload module
2014-03-06 23:51:02 +00:00
Carlton Gibson
d48e8ca8d6
Merge pull request #1459 from linovia/bugfix/optional_unique_validation
...
Unique constraint are validated even if the field is optional.
2014-03-06 22:48:16 +01:00
Peter Inglesby
2353878951
Add SEARCH_PARAM and ORDERING_PARAM to settings
...
Fixes #1434
2014-03-06 21:39:44 +00:00
Tom Christie
2090f452b2
Merge pull request #1455 from ericbuehl/master
...
don't implicitly import provider.oauth2
2014-03-06 20:33:27 +00:00
Eric Buehl
34887ed756
it's safe to import scope and constants
2014-03-06 20:21:44 +00:00
Eric Buehl
86375f2d95
Merge remote-tracking branch 'upstream/master'
2014-03-06 20:21:27 +00:00
Xavier Ordoquy
51e6982397
Fixed the validation for optional fields that have a value.
2014-03-06 21:18:37 +01:00
Xavier Ordoquy
caf4d36cb3
More complex test case.
2014-03-06 21:17:41 +01:00
Xavier Ordoquy
de899824b8
Forgot to add the ref field to the field list.
2014-03-06 16:43:30 +01:00
Xavier Ordoquy
9e291879d1
Added an optional unique field to Album and checked that duplicates are detected.
2014-03-06 15:24:07 +01:00
Tom Christie
ef94861c2d
It's 2014 now, dontchaknow
2014-03-06 09:25:18 +00:00
Tom Christie
c1148241ee
Version 2.3.13
2014-03-06 09:01:05 +00:00
Tom Christie
ab05689393
Merge pull request #1454 from rhcarvalho/patch-2
...
Fix typo
2014-03-05 17:55:52 +00:00
Eric Buehl
e0682e9298
don't implicitly import provider.oauth2
2014-03-05 17:15:52 +00:00
Rodolfo Carvalho
94fe03779b
Fix typo
2014-03-05 17:01:54 +01:00
Tom Christie
45ae5081f7
Merge pull request #1453 from davidbgk/patch-2
...
Update documentation of render methods (obj to data)
2014-03-04 16:24:18 +00:00
David Larlet
84e7bf6796
Update documentation of render methods (obj to data)
2014-03-04 17:21:07 +01:00
Tom Christie
71ea5b73ce
Merge pull request #1452 from davidbgk/patch-1
...
Typo in keywords arguments name
2014-03-04 15:33:41 +00:00