S.Prymak
ed8143b2b0
Test for customizable HyperlinkedModelSerializer url field name
2014-01-14 13:58:17 +02:00
Tom Christie
85d74fc86a
Added write_only and write_only_fields. Refs #1306
2014-01-14 11:25:44 +00:00
Tom Christie
e91d0a69ab
Merge branch 'testing-nested-serializers' of git://github.com/dustinfarris/django-rest-framework into dustinfarris-testing-nested-serializers
2014-01-13 17:38:03 +00:00
Dustin Farris
c4d77667cf
Move ImportingModelSerializerTests and add comments.
2014-01-13 12:03:13 -05:00
Dustin Farris
b1b58762a3
Move models.resolve_model to serializers._resolve_model
2014-01-13 11:47:44 -05:00
Tom Christie
4ab97843e8
Merge pull request #1333 from bodylabs/2.4.0+lookup_regex
...
Let viewsets specify their regex
2014-01-13 07:34:58 -08:00
Dustin Farris
2332382b51
Add a sanity check to avoid running into unresolved related models.
2014-01-12 20:28:19 -05:00
Yuri Prezument
0fd0454a5c
Test for setting allow_none=True for nullable CharFields
2014-01-12 10:53:54 +02:00
Yuri Prezument
46f5c62530
Regression test for #1330 (Coerce None to '')
2014-01-12 10:53:54 +02:00
Xavier Ordoquy
a7072eb730
Test case for #1129
2014-01-09 23:19:25 +01:00
Dustin Farris
bf5b77ce6d
Move serializer import to top-level causes test error
2014-01-09 11:42:41 -05:00
Dustin Farris
52db4eadc2
Testing nested serializers with models that have str foreign key references.
2014-01-08 16:14:27 -05:00
Paul Melnikow
3cd15fb171
Router: Do not automatically adjust lookup_regex when trailing_slash is True
...
BREAKING CHANGE
When trailing_slash is set to True, the router no longer will adjust the lookup regex to allow it to include periods. To simulate the old behavior, the programmer should specify `lookup_regex = '[^/]+'` on the viewset.
https://github.com/tomchristie/django-rest-framework/pull/1328#issuecomment-31517099
2014-01-04 16:57:50 -05:00
Paul Melnikow
a1d7aa8f71
Allow viewset to specify lookup value regex for routing
...
This patch allows a viewset to define a pattern for its lookup field, which the router will honor. Without this patch, any characters are allowed in the lookup field, and overriding this behavior requires subclassing router and copying and pasting the implementation of get_lookup_regex.
It's possible it would be better to remove this functionality from the routers and simply expose a parameter to get_lookup_regex which allows overriding the lookup_regex. That way the viewset config logic could be in the a subclass, which could invoke the super method directly.
I'm using this now for PostgreSQL UUID fields using https://github.com/dcramer/django-uuidfield . Without this patch, that field passes the lookup string to the database driver, which raises a DataError to complain about the invalid UUID. It's possible the field ought to signal this error in a different way, which could obviate the need to specify a pattern.
2014-01-04 16:45:03 -05:00
S. Andrew Sheppard
25bd6d1d4b
can't save genericrelations via nested serializers in django 1.6
2013-12-23 22:27:40 -06:00
Tom Christie
feddd16c54
Tweak test style
2013-12-23 12:04:17 +00:00
Tom Christie
3f5e3c28f5
Updated tests to pass in python 3
2013-12-23 11:55:25 +00:00
Tom Christie
52686420f4
Merge branch 'bennbollay-patch-1' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/routers.md
rest_framework/compat.py
tox.ini
2013-12-23 09:48:59 +00:00
Yin Jifeng
80e9f0d64b
fix url double quoted in Django 1.6
...
get_full_path returns unicode, so we use build_absolute_uri which
returns iri_to_uri'ed one
2013-12-23 14:33:53 +08:00
Tom Christie
b7482629c3
Merge pull request #1309 from lukaszb/errors-for-renamed-fields
...
Should it be that way?
2013-12-21 13:58:49 -08:00
Tom Christie
71ab7cda2a
Additional test for 'source' behaviour. Refs #1302
2013-12-21 21:54:51 +00:00
Lukasz Balcerzak
973f898a4b
Should it be that way?
2013-12-20 17:45:56 +01:00
Tom Christie
46906b2bdc
Merge pull request #1308 from lukaszb/missing-custom-validation-method-test
...
Added missing custom validation method test
2013-12-20 08:37:30 -08:00
Lukasz Balcerzak
71aa5f3c45
Added missing custom validation method test
2013-12-20 17:16:24 +01:00
Lukasz Balcerzak
0e3822d6e0
Updated test class name to be unique
2013-12-20 16:53:06 +01:00
Tom Christie
8894019899
Merge branch 'nullbooleanfield_testcase' of git://github.com/dpetzel/django-rest-framework into dpetzel-nullbooleanfield_testcase
...
Conflicts:
rest_framework/tests/test_serializer.py
2013-12-16 13:51:57 +00:00
Craig de Stigter
4a134eefa2
Fix expansion of writable nested serializers where the inner fields have source set.
2013-12-16 15:55:54 +13:00
Tom Christie
a87c55a93a
Compat fixes for django-oauth-plus versions 2.0-2.2.1
2013-12-13 21:57:07 +00:00
Tom Christie
fac6d1a36e
Merge branch 'master' of git://github.com/philipforget/django-rest-framework into philipforget-master
2013-12-13 20:40:11 +00:00
Kevin Brown
90edcbf938
Fix default values always being False for browsable API
...
This fixes a bug that was introduced in 28ff6fb
[1] for the
browsable API, specifically with how it handled default values
for boolean fields. Previously, it had a global default for
boolean fields set to `False`, which was different than the
standard None that was used elsewhere. Because this only needed
to be done for the browsable API, a fix was put into place that
only set the default to `False` when form data was passed into
the serializer. This had the unintended side effect of overriding
any default set on the boolean field.
This fixes #1101 [2] by only overriding the default if the default is
`None`, which is the default for all fields.
[1]: 28ff6fb1ec
[2]: https://github.com/tomchristie/django-rest-framework/issues/1101
2013-12-13 13:20:29 -05:00
Tom Christie
9c41c007af
Merge branch 'master' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/routers.md
docs/topics/release-notes.md
rest_framework/compat.py
2013-12-13 16:32:34 +00:00
Tom Christie
a129bdd0f0
Merge pull request #1234 from linovia/bugfix/nested_models_without_related_name
...
Fixed the nested model serializers in case of the related_name isn’t set...
2013-12-13 03:06:14 -08:00
Tom Christie
ddd17c69e7
Fix compat issues for #1231
2013-12-09 09:24:10 +00:00
Tom Christie
a6ca943faa
Merge branch 'issue-1231-jsonencoder' of git://github.com/mbox/django-rest-framework into mbox-issue-1231-jsonencoder
2013-12-09 08:50:31 +00:00
Tom Christie
80ef2685e5
Merge master
2013-12-09 07:45:45 +00:00
Tom Christie
4e9385e709
Drop unneeded assert
2013-12-09 07:37:13 +00:00
Tom Christie
06d8a31e13
Catch and mask ParseErrors that occur during rendering of the BrowsableAPI.
2013-12-09 07:34:08 +00:00
kahnjw
23db6c9849
PEP8 Compliance
2013-12-06 14:52:39 -08:00
kahnjw
9ab0759e38
Add tests to pass for get_ident method in BaseThrottle class.
2013-12-06 14:21:33 -08:00
Tom Christie
910de38a9c
Version 2.3.10
2013-12-06 22:13:50 +00:00
Chuck Harmston
cf6c11bd4b
Raise appropriate error in serializer when making a partial update to set a required RelatedField to null (issue #1158 )
2013-12-06 14:00:23 -06:00
Tom Christie
38d78b21c0
Remove Content-Type header from empty responses. Fixes #1196
2013-12-03 16:55:11 +00:00
Tom Christie
774298f145
First pass at a test for ParseErrors breaking the browsable API
2013-12-03 16:18:35 +00:00
Ian Foote
8d09f56061
Add unittests for ChoiceField metadata.
...
Rename 'name' to 'display_name'.
2013-11-27 11:06:42 +00:00
Malcolm Box
6af31ed394
Remove u from literals
2013-11-22 10:59:48 +00:00
Malcolm Box
263281d71d
Fix issue #1231 : JSONEncoder doesn't handle dict-like objects
...
Check for __getitem__ and then attempt to convert to a dict.
The check for __getitem__ is there as there's no universal way to
check if an object is a mapping type, but this is a likely proxy
2013-11-21 20:09:48 +00:00
Krzysztof Jurewicz
9cea6880f7
Added handling of validation errors in PUT-as-create.
...
Fixes #1035 .
2013-11-19 15:49:31 +01:00
Xavier Ordoquy
88f5921f2f
Removed the DynamicSerializerView duplication
2013-11-18 20:15:35 +01:00
Xavier Ordoquy
ad7aa8fe48
Fixed the nested model serializers in case of the related_name isn’t set.
2013-11-17 01:27:16 +01:00
Philip Forget
b86765d9c0
add auth param to request client calls
2013-11-15 12:25:32 -05:00
Alex
5136798a04
Merge branch 'master' into allow-aggregate-ordering
2013-11-12 23:40:24 +00:00
Alex
d1dc68d755
Add queryset aggregates to allowed fields in OrderingFilter
2013-11-12 23:40:07 +00:00
Mathieu Pillard
5829eb7a5b
Drop u'' prefix for python 3.x compatibility
2013-11-06 12:51:40 +01:00
Mathieu Pillard
5325890821
Improve handling of 'empty' values for ChoiceField
...
The empty value defaults back to '' (for backwards-compatibility) but
is changed automatically to None for ModelSerializers if the `null`
property is set on the db field.
2013-11-05 17:21:18 +01:00
alexanderlukanin13
6b3500b684
Fixed UnicodeEncodeError when POST JSON via web interface; added test
2013-10-24 17:52:52 +06:00
Ross McFarland
c36122a7ba
remove stray func from test
2013-10-21 14:26:21 -07:00
Ross McFarland
63e6a3b492
paginator should validate page and provide default
...
- use the standard paginator.validate_number method rather
strict_postive_int.
- support optional paginator method, default_page_number, to get the default
page number rather than hard-coding it to 1
- this allows supporting non-integer based pagination which can be an
important performance tweak on extermely large datasets or high request
loads
- relatively thorough unit tests of the changes
2013-10-19 21:11:27 -07:00
dpetzel
735c75abb9
add test case around ensuring proper field inference for boolean model field types
2013-10-18 21:10:49 -04:00
Tom Christie
2394f05e5a
Merge pull request #1170 from craigds/write-into-foreignkey-with-source
...
fix writing into foreign key with non-null source
2013-10-17 07:59:29 -07:00
Tom Christie
6a40202a64
Merge pull request #1112 from tamakisquare/issue-1111
...
Test case and fix for issue 1111
2013-10-17 07:31:15 -07:00
badaud_t
b730aec0f4
Fix decimal support with YAMLRenderer
2013-10-17 01:08:24 +02:00
badaud_t
8a5fea06f0
Fix typo YAMLRendererTests
2013-10-17 01:07:50 +02:00
Craig de Stigter
86ea969e11
fix ticket link in test docstring
2013-10-11 15:50:07 +13:00
Craig de Stigter
7c3769f04b
fix writing into foreign key with non-null source
2013-10-11 15:31:55 +13:00
Tom Christie
f18158358d
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
2013-10-10 17:34:15 +01:00
Tom Christie
c3e370b168
Merge branch 'html-form-rendering'
2013-10-10 17:33:39 +01:00
Tom Christie
9e29c63895
Ensure read-only fields don't break with current HTML renderer behavior
2013-10-10 17:33:22 +01:00
Carlton Gibson
0bbc775b95
Merge pull request #1071 from craigds/field-transform-methods
...
Feature: add transform_<fieldname> methods to serializers
2013-10-09 01:11:46 -07:00
Philip Douglas
a2ae469f6b
Merge remote-tracking branch 'upstream/master'
2013-10-03 11:12:55 +01:00
Craig de Stigter
dc650f77b5
add tests for transform_fieldname methods
2013-10-03 11:34:42 +13:00
Tom Christie
e441f85109
Drop 1.3 support
2013-09-25 10:30:04 +01:00
Tom Christie
21cd638659
Merge master
2013-09-25 09:44:26 +01:00
Markus Kaiserswerth
abbe9213f9
Address pending deprecation of Model._meta.module_name in Django 1.6
2013-09-23 17:48:25 +02:00
Carlton Gibson
b82c44af48
Correct typo in doc string.
2013-09-20 14:20:21 +02:00
Carlton Gibson
f07a4f4ca3
Clear cached serializer data on save()
+ test. Fixes #1116 .
2013-09-20 14:10:46 +02:00
Colin Huang
b74c5235c5
[Add]: CustomValidationTests.test_partial_update
...
This test is to make sure that validate_<attrname> is not called when
partial=True and <attrname> is not found in .data.
2013-09-15 22:22:52 -07:00
Rajiv Bose
0de1a1a0ad
Typo in strings referring to Python package, django-filter.
...
On skip of django_filters related unit-tests the reason given states the Python package 'django-filters' is not install.
However, the Python package required to run django_filters related tests is 'django-filter'.
2013-09-13 11:55:16 +01:00
Philip Douglas
e5da0ff5e5
Merge remote-tracking branch 'upstream/master'
2013-09-13 10:47:06 +01:00
Philip Douglas
6e4bdb5596
Add missing newline at the end of test file
2013-09-12 16:04:33 +01:00
Philip Douglas
59cce01b33
Fix error when serializer gets files but no data
2013-09-12 16:03:20 +01:00
Tom Christie
5970baa201
Tweaks and docs to object-level model permissions.
2013-09-10 21:00:13 +01:00
Tom Christie
75fb4b02b4
Merge branch 'master' of git://github.com/bwreilly/django-rest-framework into bwreilly-master
2013-09-10 20:21:15 +01:00
bwreilly
0183c69538
removed unnecessary guardian req and view.action parsing
2013-09-09 08:39:09 -07:00
bwreilly
118645e480
first pass at object level permissions and tests
2013-09-07 23:18:52 -05:00
Andy Freeland
b5523bcc7d
Support customizable view EXCEPTION_HANDLER
...
Add `api_settings.EXCEPTION_HANDLER` to support custom error responses.
Fixes #907 .
2013-09-06 12:47:33 -05:00
bwreilly
b07de86ad3
some properly failing tests, set up for standard permissions
2013-09-06 12:35:06 -05:00
bwreilly
4a9dcfa760
added guardian as optional requirement, stubbed out object-level permission class
2013-09-06 11:01:31 -05:00
Tom Christie
196a895fe4
Merge pull request #1076 from edmondwong/master
...
Allow OPTIONS to retrieve PUT field metadata on empty objects
2013-09-05 12:24:17 -07:00
Edmond Wong
6e7e4fc01c
Added test for OPTIONS before object creation from a PUT
2013-09-03 12:30:18 -07:00
Yuri Prezument
a15cda4be4
Regression test for #1072
2013-08-31 17:10:15 +03:00
Tom Christie
9a5b2eefa9
Merge master
2013-08-30 09:28:33 +01:00
Tom Christie
cba972911a
Fix failing empty serializer test
2013-08-30 09:12:39 +01:00
Tom Christie
3fba60e99c
Drop broken placeholder serializations.
2013-08-30 09:02:54 +01:00
Mathieu Pillard
11071499a7
Make ChoiceField.from_native() follow IntegerField behaviour on empty values
2013-08-29 18:10:47 +02:00
Tom Christie
4c53fb883f
Tweak MAX_PAGINATE_BY behavior in edge case.
...
Always respect `paginate_by` settings if client does not specify page
size. (Even if the developer has misconfigured, so that `paginate_by >
max`.)
2013-08-28 12:52:38 +01:00
Tom Christie
e1b54f2a2a
Merge branch 'max_paginate_by' of git://github.com/alexander-akhmetov/django-rest-framework into alexander-akhmetov-max_paginate_by
2013-08-27 20:58:30 +01:00
Alexander Akhmetov
316de3a8a3
Added max_paginate_by parameter
2013-08-26 20:14:17 +04:00
Tom Christie
c77e4a2c59
Merge branch 'master' into html-form-renderer
2013-08-23 16:46:14 +01:00
Tom Christie
1c935cd3d2
Fix failing test for router with no trailing slash
2013-08-23 15:18:47 +01:00
Tom Christie
b72a99fef2
Merge branch 'display-nested-data' into html-form-renderer
2013-08-23 14:39:52 +01:00