Commit Graph

1345 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Tom Christie
4ee9cdc7af Fix compat datetime import when oauth2 provide does not support timezone aware datetimes 2013-06-28 09:35:52 +01:00
Tom Christie
58d38d694e Merge branch 'master' into writable-nested-modelserializer 2013-06-28 09:07:09 +01:00
Tom Christie
7ba2f44a0f Version 2.3.6 2013-06-27 13:00:05 +01:00
Tom Christie
e0dddbc5de Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2013-06-27 12:32:46 +01:00
Tom Christie
96f41fd12d Use imported views to expose python 2.6 bug. Refs #943 2013-06-27 11:58:34 +01:00
Tom Christie
7e67ad666b Merge pull request #953 from j4mie/prevent-duplicate-routing
Prevent dynamically routing to a method that is already routed to.
2013-06-26 15:37:42 -07:00
Jamie Matthews
c127e63c32 Raise exception when attempting to dynamically route to a method that is already routed to. Fixes #940 2013-06-26 23:00:42 +01:00
Tom Christie
91b9fcb0ba Minor test cleanup 2013-06-26 22:43:17 +01:00
Tom Christie
35e4d1cf9c Merge pull request #943 from trwired/utf8safedocs
Make browsable API views play nice with utf-8
2013-06-26 14:41:07 -07:00
Tom Christie
69e5e3cc0d Use timezone aware datetimes with oauth2 provider, when supported. Closes #947. 2013-06-26 21:18:13 +01:00
Igor Kalat
c8b0e6c40f Refactored get_view_description, moved appropriate tests to test_description.py 2013-06-26 22:12:02 +02:00
Tom Christie
715bd47dfa Use AUTH_USER_MODEL consistently between various Django versions. Closes #946 2013-06-26 17:56:42 +01:00
Igor Kalat
2bf5f63050 Make browsable API views play nice with utf-8 2013-06-22 19:21:28 +02:00
Tom Christie
8cc63b09f6 Add support for StreamingHttpResponse. Closes #939 2013-06-21 22:42:04 +01:00
Tom Christie
8b0d4115c6 Merge pull request #941 from FreakyDug/master
Fixed a couple of small problems I found when using the action decorator.
2013-06-21 14:23:40 -07:00
Tom Christie
209b65f426 Update assertion error to reference 'base_name' argument, not incorrect 'name' argument. Closes #933 2013-06-21 22:13:25 +01:00
Tom Christie
3d4bb4b553 Ensure action kwargs properly handdled. Refs #940. 2013-06-21 22:03:07 +01:00
Philip Douglas
fa9f5fb8dc Allow uppercase methods in action decorator.
Previously, using uppercase for the method argument would silently fail
to route those methods.
2013-06-21 16:28:17 +01:00
Tom Christie
6d2ca75d8e Don't raise AttributeError on views with no model or queryset, when using DjangoModelPermissions 2013-06-18 11:10:56 +01:00
Tom Christie
4ad1094968 HyperlinkedModelSerializer supports overriding of 'url' field. Closes #936 2013-06-17 15:09:36 +01:00
Tom Christie
52298480c2 Clean up 2013-06-14 15:39:56 +01:00
Tom Christie
df957c8625 Fix and tests for ScopedRateThrottle. Closes #935 2013-06-14 14:18:40 +01:00
Tom Christie
614d8fec3c Merge pull request #929 from mhsparks/positive-integer-field
Added test for custom fields with min_value and max_value validators
2013-06-12 12:39:57 -07:00
Tom Christie
c4ab77b9e9 Merge pull request #926 from davesque/master
I was having problems with a custom field that used a min_value validator...
2013-06-12 12:38:35 -07:00
inglesp
b1847412b5 Typo 2013-06-12 20:00:33 +02:00
Mark Hughes
82c515c19c Added test for custom fields with min_value and max_value validators 2013-06-12 17:36:16 +01:00
David Sanders
fcaca73709 Pep8 lint 2013-06-11 16:10:25 -06:00
David Sanders
656897c2da Update ModelField to work with a broader range of fields
Add support for fields that use min and max value validators.
2013-06-11 16:09:32 -06:00
Ethan Fremen
d89aade343 Allow the default router to have a custom name.
Signed-off-by: Ethan Fremen <ethan@matterport.com>
2013-06-07 19:49:18 -07:00
Ethan Fremen
ae2887ffc4 Set the args and kwargs before initializing the request.
Allows get_parser_context to function correctly.

Signed-off-by: Ethan Fremen <ethan@matterport.com>
2013-06-07 19:25:39 -07:00
Tom Christie
db8d61196a Merge pull request #915 from aburgel/fix-oauth-bad-consumer-key
Fix serialization exception caused by non-existent consumer
2013-06-06 00:58:54 -07:00
Tom Christie
40e09472d8 Never deepcopy validators. Closes #913 2013-06-06 08:56:39 +01:00
Alex Burgel
ecb8a460c9 Fix serialization exception when using non-existent consumer 2013-06-05 17:02:44 -04:00
Tom Christie
f8a0d31d71 Remove ConfigurationError in favor of Django's ImproperlyConfigured 2013-06-05 13:45:28 +01:00
Tom Christie
de00ec95c3 Merge master 2013-06-05 13:33:19 +01:00
Tom Christie
2ca243a114 Fix up tests and tox 2013-06-05 13:20:06 +01:00
Tom Christie
f1251e8c58 Added trailing_slash argument to routers. Closes #905 2013-06-04 20:59:12 +01:00
Tom Christie
c160e49321 Test cases and fix for plain-list relationships (ie not queryset) Closes #878. 2013-06-04 14:05:35 +01:00
Tom Christie
478f6ff94a Regression test for #840. Closes #840. 2013-06-03 21:21:47 +01:00
Tom Christie
87b8cb8524 Merge pull request #904 from menghan/fix-doc-typo
fix doc typo
2013-06-03 08:04:32 -07:00
Tom Christie
28c2c46a03 Version 2.3.5 2013-06-03 12:34:18 +01:00
Tom Christie
6e0567c271 request.user should be still be accessible in renderer context if authentication fails 2013-06-03 12:32:57 +01:00
Tom Christie
62e59f8277 Merge pull request #900 from copitux/fix-validation-layer
Bugfix: Fix run validation layer with invalid data
2013-06-03 00:49:02 -07:00
Tom Christie
1bb5fb8e4a Merge pull request #895 from linovia/django1.6a1
Added Django 1.6a1 to the test matrix.
2013-06-02 13:11:49 -07:00
Tom Christie
a3796f430b Only use test import munging prior to Django 1.6's new test runner 2013-06-02 21:04:47 +01:00
Tom Christie
27d8b848bc Add notes on 'method' argument to '@action' decorator 2013-06-02 20:40:56 +01:00