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
Alan Justino
d3a118c728
SimpleRouter.get_lookup_regex got lookup_prefix
...
This allows @alanjds/drf-nested-routers to not duplicate/monkeypatch work made here
2013-12-10 17:14:17 -02:00
Tom Christie
3a1c40f814
Refine model manager behavior so as not to use the behavior in incorrect cases. Closes #1205
2013-12-10 08:46:44 +00: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
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
1f8069c0a9
Boilerplate cuteness
2013-12-05 11:05:25 +00: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
Tom Christie
344cd865ab
Merge pull request #1250 from Ian-Foote/choice_field
...
Add choices to options metadata for ChoiceField.
2013-12-03 08:03:02 -08:00
Tom Christie
c1d9a96df0
Catch errors during parsing and set empty .DATA/.FILES before re-raising.
2013-12-03 08:58:05 +00:00
Pablo Recio
699ec7236b
Adds pre_delete and post_delete hooks on
2013-12-03 00:07:41 +00:00
Omer Katz
b8f8fb7779
Updated the assertion message of the ImageField.
2013-11-27 13:26:49 +02:00
Ian Foote
8d09f56061
Add unittests for ChoiceField metadata.
...
Rename 'name' to 'display_name'.
2013-11-27 11:06:42 +00:00
Ian Foote
2484fc9141
Add more context to the ChoiceField metadata.
2013-11-26 17:10:16 +00:00
Ian Foote
a38d9d5b24
Add choices to options metadata for ChoiceField.
2013-11-26 09:33:47 +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
Tom Christie
43c4e3aab8
Merge pull request #1229 from jgomezb/patch-2
...
Update urlpatterns.py
2013-11-21 01:43:07 -08: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
a8b15f4290
Another fix for nested writable serializers in case of the related_name isn’t set on the ForeignKey.
2013-11-18 15:11:29 +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
Tom Christie
7a0e2ed6f6
Version 2.3.9
2013-11-15 13:55:36 +00:00
Philip Forget
5239362951
pass oauth_timestamp to oauth_provider
2013-11-14 18:02:07 -05:00
jgomezb
6be62bc1d7
Update urlpatterns.py
...
Allow numbers in format extension.
2013-11-14 09:22:07 +01:00
Alex
e29942948f
Undo version bump
2013-11-13 12:06:59 +00:00
Alex
f4e610248b
Bump version
2013-11-12 23:46:01 +00: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
Doğan Çeçen
fd2c291c4d
Typo on api-guide/fields.md and serializers.py
2013-11-11 11:54:30 +02:00
Tom Christie
470134ae9b
Merge pull request #1217 from benpbenp/master
...
Fix object creation with reverse M2M when related_name unspecified
2013-11-08 07:15:40 -08:00
Ben Pietravalle
b7b57adee2
Fix object creation with reverse M2M when related_name unspecified
...
It seems that field.related_query_name() does not return the related_name
for reverse M2M relations when related_name is not explicitly set in the M2M field
definition.
So, change to use obj.get_accessor_name(), where obj is an instance of
RelatedObject, as are returned by a model's
_meta.get_all_related_many_to_many_objects(), or as in the tuples returned by
_meta.get_all_m2m_objects_with_model().
2013-11-08 13:19:40 +00:00
Xavier Ordoquy
d4a50429b0
Fixed a regression with ValidationError under Django 1.6
2013-11-08 13:12:40 +01: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
Rob Hudson
e33435d0da
Fixed exception handling with YAML and XML parsers.
2013-10-31 15:03:50 -07:00
S. Andrew Sheppard
458af921f3
minor typo
2013-10-29 15:10:06 -05:00
Jakub Roztočil
be55a3c5c7
Removed commented-out credits from footer to make django-debug-toolbar work.
...
The comment, although valid, caused that the Django debug toolbar's injected HTML was partially commented-out and thus the toolbar didn't work as expected.
2013-10-24 17:53:02 +02:00
Chris Guethle
7a87893b96
reworked APIException, pushing some of the status_code and detail management up. Also, makes the APIException useful in isolation (defaults to status code 500)
2013-10-24 09:40:43 -05:00
Yamila Moreno
82e9ddcf7a
Added get_filter_backends method
2013-10-24 16:16:01 +02:00
Tom Christie
0fc9d5fed9
Merge pull request #1198 from alexanderlukanin13/form-post-unicode
...
Fixed UnicodeEncodeError when POST JSON via web interface; added test
2013-10-24 05:45:55 -07:00
Tom Christie
6302307885
Update comment in get_parser_context
.
2013-10-24 13:45:16 +01:00
alexanderlukanin13
6b3500b684
Fixed UnicodeEncodeError when POST JSON via web interface; added test
2013-10-24 17:52:52 +06:00
Tom Christie
f2648fefff
Merge pull request #1187 from ross/paginator_def_val
...
paginator should validate page and provide default
2013-10-22 02:19:36 -07:00
Ross McFarland
c36122a7ba
remove stray func from test
2013-10-21 14:26:21 -07:00
Ross McFarland
f0a129dcda
retract the default page stuff.
...
better way comming in a seperate pr
2013-10-21 14:23:06 -07:00
Tom Christie
216ac8a5c1
Use lookup_url_kwarg in presave if required
2013-10-21 17:19:28 +01:00
Tom Christie
76672787cd
Added . Closes #1188 .
2013-10-21 09:47:07 +01: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
17a00be830
This fix results in models.NullBooleanField rendering as a checkbox in the browsable API
2013-10-18 21:13:20 -04: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
Tom Christie
8c60471766
Merge pull request #1172 from brutasse/fix/return-object
...
Return object in save_object
2013-10-17 07:19:38 -07:00
Bruno Renié
cc3c16eaa0
Fix a docstring to reflect what the method does
2013-10-17 16:08:17 +02: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
Omer Katz
d31fd33f4b
Allow to customize description so that markup can be accepted if needed.
2013-10-16 09:15:02 -04:00
Colin Huang
c6be12f02b
[Fix]: Error with partial=True and validate_<name>
...
The error occurs when serializer is set with partial=True and a
field-level validation is defined on a field, for which there's no
corresponding update value in .data
2013-10-15 17:05:10 -07: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
Henry Clifford
3e94f4dc70
support args on get_object_or_404
2013-10-04 10:49:56 -04: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
8d4ba478cc
Fix rendering of forms and add error rendering on HTML form
2013-10-02 16:13:34 +01:00
Tom Christie
a14f1e8864
Serializers can now be rendered directly to HTML
2013-10-02 13:45:35 +01:00
Tom Christie
1fd83adb9c
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
2013-09-26 16:09:31 +01:00
Tom Christie
75d6446c87
Allow .template_name attribute specified on view. Closes #1000
2013-09-26 16:09:08 +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
Tom Christie
36bd4f22a7
Merge pull request #1107 from dpretty/master
...
Let JSONEncoder handle Numpy data types.
2013-09-13 11:42:15 -07:00
Tai Lee
a9dbd46c94
Refs #1109 -- Update docs. Integrate changes from feedback.
2013-09-14 00:54:44 +10:00
Tai Lee
bb3261ca48
Fixed #1105 -- Add hook for custom context in BrowsableAPIRenderer
.
...
Replace hard coded response status check with `allow_form` context
variable, so that it can be overridden in a custom renderer class.
2013-09-13 23:11:44 +10: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
272a6abf91
Try a more localised fix to the data=None problem
2013-09-13 10:46:24 +01:00
David Pretty
d489c5c881
Let JSONEncoder handle Numpy data types.
...
json.JSONEncoder cannot serialize Numpy data types. Numpy arrays
and array scalars have a tolist() method which casts the object to
a standard python data type.
2013-09-13 13:36:18 +10:00
Tom Christie
cd3040737e
Merge pull request #1097 from mociepka/add_default_order_by_in_filtering
...
Add order_by to the AutoFilterSet
2013-09-12 13:24:26 -07: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
195790e60b
Version 2.3.8
2013-09-11 09:09:30 +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
Michał Ociepka
222c1d1122
Add order_by to the AutoFilterSet
...
`AutoFilterSet` should contains `order_by` set to all by default.
2013-09-10 12:02:14 +02:00
bwreilly
23fc9dd53f
better doc for object permissions, drop redundant has_permission call
2013-09-09 09:32:29 -07:00
bwreilly
0183c69538
removed unnecessary guardian req and view.action parsing
2013-09-09 08:39:09 -07:00
bwreilly
9ff0f6d3bf
switch to a dedicated filter for read list object permissions
2013-09-07 23:48:03 -05:00
bwreilly
118645e480
first pass at object level permissions and tests
2013-09-07 23:18:52 -05:00
bwreilly
57d6b5fb7c
necessary test settings for guardian
2013-09-07 23:16:43 -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
745ebeca77
Handle case where obj=None in PKRelatedField.field_to_native()
...
Fixes #1072
2013-08-31 17:20:49 +03:00
Yuri Prezument
a15cda4be4
Regression test for #1072
2013-08-31 17:10:15 +03:00
Edmond Wong
3063a50fc2
Allow OPTIONS to retrieve PUT field metadata on empty objects
...
This allows OPTIONS to return the PUT endpoint's object serializer metadata when the object hasn't been created yet.
2013-08-30 18:03:44 -07:00
Tom Christie
f3ab0b2b1d
Browsable API tab preferences should be site-wide
2013-08-30 09:20:12 +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
Tom Christie
2247fd68e9
Fix multipart error when used via content-type overloading
2013-08-29 21:24:29 +01:00
Tom Christie
19f9adacb2
Merge branch 'master' into display-raw-data
2013-08-29 20:52:46 +01:00
Tom Christie
02b6836ee8
Fix breadcrumb view names
2013-08-29 20:51:51 +01:00
Tom Christie
e4d2f54529
Fix indenting on raw data forms
2013-08-29 20:39:05 +01:00
Tom Christie
44f8d1bef2
Fix tab preferences on PUT forms
2013-08-29 20:38:55 +01:00
Tom Christie
1fa2d823cc
Preserve tab preference in cookies.
2013-08-29 20:35:59 +01:00
Tom Christie
c7f3b8bebe
Include serialized content in raw data form.
2013-08-29 17:23:26 +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
37e2720a40
Add override_method
context manager and cleanup.
2013-08-29 12:55:56 +01:00
Craig de Stigter
94cd136943
add transform_<fieldname> methods to serializers, which basically do the opposite of validate_<fieldname> on a per-field basis.
2013-08-29 17:35:15 +12:00
Tom Christie
18007d6846
Simplifying raw data renderering support
2013-08-28 21:52:56 +01:00
Tom Christie
2d5e14a8d3
Throttles now use HTTP_X_FORWARDED_FOR, falling back to REMOTE_ADDR to identify anonymous requests
2013-08-28 15:32:41 +01:00
Tom Christie
97b52156cc
Added .cache
attribute on throttles.
...
Closes #1066 . More localised than a new settings key, and more
flexible in that different throttles can use different behavior.
Thanks to @chicheng for the report! :)
2013-08-28 13:34:14 +01: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
7fb3f078f0
fix for python3
2013-08-27 17:42:10 +04:00
Tom Christie
b54cbd292c
Use view.settings for API settings, to make testing easier.
2013-08-27 12:36:06 +01:00
Tom Christie
b430503fa6
Move exception handler out of main view
2013-08-27 12:32:33 +01:00
Tom Christie
dce47a11d3
Move settings into more sensible ordering
2013-08-27 12:32:13 +01:00
Tom Christie
8d590ebfde
First hacky pass at displaying raw data
2013-08-27 11:22:19 +01:00
Alexander Akhmetov
316de3a8a3
Added max_paginate_by parameter
2013-08-26 20:14:17 +04:00
Tom Christie
ab68d355f5
Merge pull request #1058 from ericbuehl/master
...
parameterize identity field serializer class to allow for easier subclassing
2013-08-25 12:46:11 -07:00
Eric Buehl
9d3fae27fd
parameterize identity field class to allow for easier subclassing
2013-08-23 16:48:32 +00:00
Tom Christie
be0f5850c3
Extra docs
2013-08-23 16:51:34 +01:00
Tom Christie
c77e4a2c59
Merge branch 'master' into html-form-renderer
2013-08-23 16:46:14 +01:00
Tom Christie
436e66a42d
JSON responses should not include a charset
2013-08-23 16:45:55 +01:00
Tom Christie
e23d588852
Adding standard renderer attributes and documenting
2013-08-23 16:16:41 +01:00
Tom Christie
10d386ec6a
Cleanup and dealing with empty form data.
2013-08-23 16:10:20 +01:00
Tom Christie
1c935cd3d2
Fix failing test for router with no trailing slash
2013-08-23 15:18:47 +01:00
Tom Christie
005f475c6a
Don't consume .json style suffixes with routers.
...
When trailing slash is false, the lookup regex should not consume '.'
characters. Fixes #1057 .
2013-08-23 14:58:06 +01:00
Tom Christie
b72a99fef2
Merge branch 'display-nested-data' into html-form-renderer
2013-08-23 14:39:52 +01:00
Tom Christie
0966a2680b
First pass at HTMLFormRenderer
2013-08-23 14:38:31 +01:00
Tom Christie
e03854ba6a
Tweaks to display nested data in empty serializers
2013-08-23 14:06:14 +01:00
Tom Christie
e7927e9bca
Extra docs on PATCH with no object.
2013-08-23 13:35:50 +01:00
Tom Christie
110d549404
Merge pull request #1034 from KrzysiekJ/patch-create-fallback-removal
...
PATCH requests should not be able to create objects.
2013-08-23 05:34:00 -07:00
Tom Christie
95b2bf50fb
Add validation error test when passing non-file to FileField
2013-08-23 12:03:54 +01:00
Tom Christie
47d17b088a
Merge branch 'fix_937' of git://github.com/aburgel/django-rest-framework into aburgel-fix_937
2013-08-23 11:56:22 +01:00
Tom Christie
19a774f972
force_authenticate(None) also clears session info.
...
Closes #1055 .
2013-08-23 11:21:52 +01:00