Commit Graph

1393 Commits

Author SHA1 Message Date
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
Tom Christie
1bd8fe4152 Whitespace fix 2013-09-25 10:36:08 +01: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
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
9a5b2eefa9 Merge master 2013-08-30 09:28:33 +01: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
Tom Christie
f631f55f8e Tweak comment 2013-08-21 21:35:17 +01:00
Tom Christie
16ffdedd14 Merge master 2013-08-21 21:31:59 +01:00
Tom Christie
44ceef8415 Updating 2.4.0 release notes 2013-08-21 21:30:25 +01:00
Tom Christie
2bcad32dcb If page size query param <= 0, just use default page size.
Closes #1028.
2013-08-21 21:22:12 +01:00
Tom Christie
815ef50735 If page size query param <= 0, just use default page size.
Closes #1028
2013-08-21 21:18:46 +01:00
Tom Christie
db25aaff3a Merge branch 'static-routes' into 0.4.0 2013-08-21 20:36:07 +01:00
Tom Christie
7cc1d38d22 Merge branch 'boolean-field-required-1004' of git://github.com/willkg/django-rest-framework 2013-08-19 21:44:52 +01:00
Tom Christie
28ff6fb1ec Only HTML forms should have implicit default False for boolean fields 2013-08-19 21:44:47 +01:00
Tom Christie
8acee2e626 Commenting link/action decorators as pending deprecation 2013-08-19 21:02:22 +01:00
Tom Christie
28e44efe25 Merge branch 'master' into 2.4.0 2013-08-19 20:58:28 +01:00
Tom Christie
c607414f16 Merge 2013-08-19 20:36:18 +01:00
Tom Christie
5120670624 Document customizable view names/descriptions 2013-08-19 08:45:53 +01:00
Tom Christie
89b0a539c3 Move view name/description functions into public space 2013-08-19 08:24:27 +01:00
Tom Christie
a8aabe23c9 Merge branch 'master' of git://github.com/chrispaolini/django-rest-framework into chrispaolini-master 2013-08-19 07:40:30 +01:00
Christopher Paolini
5a374955b1 Updated tests for view name and description
Updated the tests to use the default view_name and view_description
functions in the formatter through the default in settings.
2013-08-18 00:29:05 -04:00
Christopher Paolini
11d7c1838a Updated default view name/description functions
Forgot to update the default view name/description functions to the new
setup.
2013-08-17 17:52:08 -04:00
Christopher Paolini
e6662d434f Improved view/description function setting
Now supports each View having its own name and description function and
overriding the global default.
2013-08-17 17:44:51 -04:00
Christopher Paolini
a95984e4d4 Settings now have default functions
Updated the setting to have a default function.
2013-08-16 13:23:04 -04:00
Will Kahn-Greene
430f00847a Add test for BooleanField and required
This tests setting required=True on a BooleanField.

Test for issue #1004.
2013-08-16 09:20:49 -04:00
Tom Christie
f6f69dc71d Version 2.3.7 2013-08-16 14:03:20 +01:00
Tom Christie
7b27997a01 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2013-08-15 21:36:54 +01:00
Tom Christie
f34b9ff049 AnonRateThrottle should always allow authenticated users. Closes #994 2013-08-15 21:36:45 +01:00
Christopher Paolini
d07dae6e79 Ability to override name/description of view
Added settings and additions to formatting.py
2013-08-15 12:41:52 -04:00
Chad Barrington
99083baf25 Update filters.py
Fixed cut n pasted get_ordering docstring for ya bro.
2013-08-14 16:01:25 -05:00
Chad Barrington
486f4c8047 Update filters.py
Here's a little cleanup for ya, brah!
2013-08-14 15:18:44 -05:00
Tom Christie
44401273f7 Merge pull request #1038 from jsatt/nontime_throttling
don't set X-Throttle-Wait-Second header if throttle wait is None
2013-08-14 05:15:57 -07:00
JT
2f03870ae1 Fix for "No module named compat" 2013-08-13 18:48:49 -05:00
Jeremy Satterfield
1d8a80f5cc don't set X-Throttle-Wait-Second header if throttle wait is None 2013-08-13 15:31:58 -05:00
Krzysztof Jurewicz
e677f3ee5c PATCH requests should not be able to create objects. 2013-08-13 13:26:30 +02:00
Yuri Prezument
ff1efcf60f If null or blank - don't save the nested object 2013-08-12 21:06:37 +03:00
Yuri Prezument
901d2b0eb8 Failing test case for nullifying nested object 2013-08-12 21:06:37 +03:00
Yuri Prezument
abe655e061 Make OneToOneSource.target nullable 2013-08-12 21:06:37 +03:00
Yuri Prezument
cd5f1bb229 Fix PATCH button title in template 2013-08-12 15:44:00 +03:00
Tom Christie
fbd4c4ee8f Merge pull request #1030 from etos/patch-2
Spelling correction on read_only_fields err msg
2013-08-12 01:25:36 -07:00
Dan Stephenson
bbdcbe9452 Spelling correction on read_only_fields err msg
just spotted extras
2013-08-10 01:22:47 +01:00
Dan Stephenson
edd696292c Spelling correction on read_only_fields err msg 2013-08-10 01:12:36 +01:00
Kevin Brown
103fed9667 Fixed reversed arguments in assertion 2013-07-26 10:59:51 -04:00
Alex Burgel
db9672d304 Add support for removing field files by sending an empty string 2013-07-24 17:24:29 -04:00
Pavel Zinovkin
b6d6feaa02 Fixed test 2013-07-21 22:43:19 +04:00
Pavel Zinovkin
2e18fbe373 Updated EmailField error message. This one already available in django translations.
https://github.com/django/django/blob/master/django/conf/locale/ru/LC_MESSAGES/django.po#L343
2013-07-21 17:03:58 +04:00
Alex Burgel
eaae8fb2d9 Combined link_* and action_* decorators into detail_route and list_route, marked the originals as deprecated. 2013-07-15 18:35:13 -04:00
Alex Burgel
ca7ba07b4e Introduce DynamicDetailRoute and DynamicListRoute to distinguish between different route types 2013-07-15 17:59:37 -04:00
Alex Burgel
e14cbaf696 Changed collection_* decorators to list_* 2013-07-15 17:59:36 -04:00
Alex Burgel
f022743078 Rename router collection test case 2013-07-15 17:59:36 -04:00
Alex Burgel
8d521c068a Revert route name change and add key to Route object to identify different route types 2013-07-15 17:59:36 -04:00
Alex Burgel
d72603bc6a Add support for collection routes to SimpleRouter 2013-07-15 17:59:03 -04:00
Tom Christie
82145e2b06 Only include APISimpleTestCase and APILiveServerTestCase from django 1.4 onwards 2013-07-15 21:54:13 +01:00
Tom Christie
ae63c49777 Added test case classes 2013-07-15 11:38:38 +01:00
Tom Christie
3032a06c9b Use absolute import style 2013-07-09 13:12:28 +01:00
Gertjan Oude Lohuis
db863be10c Add an ModelAdmin for easy management of Tokens 2013-07-09 12:19:13 +02:00
Tom Christie
8f79caf9d1 Use 'force_text', not 'unicode', for compat across python version 2013-07-05 09:07:18 +01:00
Tom Christie
676ab4971c Merge branch 'remove-hold-down-control-messages' of git://github.com/rouge8/django-rest-framework into rouge8-remove-hold-down-control-messages 2013-07-05 08:55:24 +01:00
Tom Christie
9e4e2c60f7 Merge branch 'master' into 2.4.0 2013-07-04 20:31:26 +01:00
Tom Christie
99794773cf Merge pull request #962 from tomchristie/test-client
APIClient and APIRequestFactory
2013-07-04 05:50:04 -07:00
Tom Christie
5fa100245c Update parser docstrings. Closes #968. 2013-07-04 12:47:35 +01:00
Andy Freeland
7d43f41e4a Remove 'Hold down "Control" ...' message from help_text
When getting the help_text from a field where `many=True`, Django
appends 'Hold down "Control", or "Command" on a Mac, to select more than
one.' to the help_text. This makes some sense in Django's ModelForms,
but no sense in the API.
2013-07-04 01:51:24 -04:00
Tom Christie
0a722de171 Complete testing docs 2013-07-01 13:59:05 +01:00
Tom Christie
c9485c783a Rename to force_authenticate 2013-06-29 22:53:15 +01:00
Tom Christie
ab799ccc3e Simplify APIClient implementation 2013-06-29 21:34:47 +01:00
Tom Christie
664f8c6365 Added APIClient.authenticate() 2013-06-29 21:02:58 +01:00
Tom Christie
35022ca921 Refactor SessionAuthentication slightly 2013-06-29 08:14:05 +01:00
Tom Christie
f7db06953b Remove unneeded tests.utils, superseeded by APIRequestFactory, APIClient 2013-06-29 08:06:11 +01:00
Tom Christie
90bc07f3f1 Addeded 'APITestClient.credentials()' 2013-06-29 08:05:08 +01:00
Tom Christie
f585480ee1 Added APIClient 2013-06-28 17:50:30 +01:00
Tom Christie
7224b20d58 Added APIRequestFactory 2013-06-28 17:17:39 +01:00
Tom Christie
05d8a90e94 Merge branch 'master' into writable-nested-modelserializer 2013-06-28 09:36:17 +01:00