Commit Graph

2084 Commits

Author SHA1 Message Date
Tom Christie
7dce364a35 Merge pull request #1829 from cezar77/login-form-errors
Display validation errors on login form
2014-09-05 12:59:26 +01:00
Cezar Pendarovski
2531b5cd86 Remove light gray bordering from the well with general message error 2014-09-05 13:28:47 +02:00
Piotr Jakimiak
6022b9ddd4 Fix comment 2014-09-05 12:00:17 +02:00
Piotr Jakimiak
d9633c6817 Fix returning None when allow_none is True in CharField 2014-09-05 11:08:34 +02:00
Cezar Pendarovski
34b3ee9ea1 Place general error message in well 2014-09-05 11:06:30 +02:00
Cezar Pendarovski
d3ee26ba99 Change bootstrap class warning to error 2014-09-05 10:55:49 +02:00
Tom Christie
2e632e5af2 Merge pull request #1820 from carltongibson/login-dropdown
Hide login link in browsable API if the login view is not registered.
2014-09-05 09:07:14 +01:00
Cezar Pendarovski
6106701c06 Input fields get hightlighted if login fails and username is persisted 2014-09-05 09:38:54 +02:00
Cezar Pendarovski
3bc858c30b General message error goes above submit button 2014-09-04 17:51:45 +02:00
Cezar Pendarovski
ea259e8bde Error messages are displayed below the input fields 2014-09-04 16:01:27 +02:00
Cezar Pendarovski
d56efb8f82 Display validation errors on login form 2014-09-04 15:26:00 +02:00
Carlton Gibson
ef1fb3d8df Prefer format and use named blocks 2014-09-04 08:54:50 +02:00
dpanesso
1ab782a430 Using user.get_username() instead of user.username.
This solves an error when using a auth model that does not have a username field.
2014-09-03 23:38:03 -05:00
Piper Merriam
fc9be55d43 Alter CSRF exemption implementation
The previous implementation of decorating `APIView.dispach` with the
`csrf_exempt` decorator allowed for an easy-to-make mistake where
someone could override the `dispatch` method on a view and inadvertantly
remove the csrf exemption of their api view.

By moving the decoration of the view into the `as_view` logic, it
becomes much more difficult to make this mistake.
2014-09-03 09:50:31 -06:00
Tom Christie
f08afe162c Version 2.4.2 2014-09-03 16:35:17 +01:00
Tom Christie
c1036c1753 More test passing 2014-09-03 16:34:09 +01:00
Michał Jaworski
afe9b37f60 remove rogue print 2014-09-03 17:21:56 +02:00
Michał Jaworski
9195ccb97f Use explicit many=True for object_serializer instantiation in PaginationSerializer and add catch dummy 'many' kwarg on DefaultObjectSerializer 2014-09-03 16:52:41 +02:00
Carlton Gibson
4947303f20 Moved li tags inside optional_login
as per https://github.com/tomchristie/django-rest-framework/pull/1820#discussion_r16987993
2014-09-03 09:54:36 +02:00
Tom Christie
f2852811f9 Getting tests passing 2014-09-02 17:41:23 +01:00
Tom Christie
ec096a1cac Add relations and get tests running 2014-09-02 15:07:56 +01:00
Carlton Gibson
fa0ef17737 Remove Login Dropdown when Auth Views are not registered.
Fixes #1738
2014-09-02 14:53:37 +02:00
Timo Tuominen
e437520217 Generator implementation of class mapping. 2014-09-01 17:02:48 +03:00
Timo Tuominen
582f6fdd4b Add utility function to match classes in dictionary. 2014-09-01 15:54:33 +03:00
Timo Tuominen
ae84b8b0e8 Traverse the method resolution order when mapping serializer fields. 2014-09-01 15:03:39 +03:00
Timo Tuominen
82d4b20832 Add subclass matching to serializer field mapping. 2014-09-01 15:02:49 +03:00
Carlton Gibson
14877464f6 Merge pull request #1816 from carltongibson/regression-login-template
Regression for #1810: Test login view renders
2014-09-01 10:31:07 +02:00
Tom Christie
55e779c856 Version 2.4.1 2014-09-01 09:07:55 +01:00
Carlton Gibson
1c9c5d5c32 Regression for #1810: Test login view renders 2014-09-01 10:07:05 +02:00
Daniel Roseman
b554c67d14 Restore body block to base template. 2014-08-30 13:28:12 +01:00
Tom Christie
4ac4676a40 First pass 2014-08-29 16:46:26 +01:00
Tom Christie
371d30aa87 Remove unused imports. 2014-08-29 12:54:52 +01:00
Tom Christie
b552b62540 get_paginate_by no longer takes optional .queryset 2014-08-29 12:54:03 +01:00
Tom Christie
f87d32558e Remove .link() and .action() decorators. 2014-08-29 12:53:45 +01:00
Tom Christie
ce7b2cded9 Remove deprecated generic views.
`MultipleObjectAPIView` and `SingleObjectAPIView` are no longer
required.
2014-08-29 12:48:49 +01:00
Tom Christie
72c0811576 Minor tidy up. 2014-08-29 12:48:04 +01:00
Tom Christie
b3253b4283 Remove .model usage in tests.
Remove the shortcut `.model` view attribute usage from test cases.
2014-08-29 12:35:53 +01:00
Tom Christie
b8c8d10a18 Remove page_size argument.
`paginate_queryset` no longer takes an optional `page_size` argument.
2014-08-29 11:38:54 +01:00
Tom Christie
e5e6329a22 Remove pk_url_field, slug_url_field, slug_field.
Closes #1773.
2014-08-29 11:29:26 +01:00
Tom Christie
b3bbf41670 Remove allow_empty 2014-08-29 11:09:35 +01:00
Tom Christie
0f8fdf4e72 Remove allow_empty.
Closes #1774.
2014-08-29 10:57:24 +01:00
Tom Christie
f62c874ea9 Remove filter_backend.
Closes #1775.
2014-08-29 10:48:40 +01:00
Tom Christie
2a61ed8bac 2.4 Release notes 2014-08-29 10:10:17 +01:00
Tom Christie
8f4ae06b3b Merge pull request #1784 from tomchristie/remove-model-attribute
Deprecate `.model` attribute on views
2014-08-29 10:03:07 +01:00
Cezar Pendarovski
5380889275 Validation errors in the rendered HTML fixed 2014-08-28 10:39:01 +02:00
Cezar Pendarovski
e5d88a80a9 Put all TextNodes (method names) back to same line with parent element 2014-08-27 09:41:33 +02:00
Cezar Pendarovski
f6cbd88618 Merge remote-tracking branch 'upstream/master' into fix-1719
Conflicts:
	rest_framework/templates/rest_framework/base.html
2014-08-25 17:28:22 +02:00
Cezar Pendarovski
4d582fd9ff Made all color declarations in bootstrap-tweaks.css consistent 2014-08-22 10:12:52 +02:00
Cezar Pendarovski
1e2bd1294e Fixed the issue with the non-draggable horizontal scrollbar 2014-08-22 09:53:03 +02:00
Greg Doermann
f27a28682b Frameworks throws AssertionError saying you cannot set required=True and read_only=True on editable=False model fields. We should not make the field required if editable=False. 2014-08-20 11:00:37 -06:00
Tom Christie
4d8c63abc9 Deprecate .model in related routers/permissions 2014-08-20 17:15:46 +01:00
Dmitry Mukhin
3b07d0c997 Merge branch 'master' into set-retry-after
Conflicts:
	tests/test_throttling.py
2014-08-20 20:04:48 +04:00
Tom Christie
9372cc8c31 Deprecate .model attribute on views 2014-08-20 16:24:52 +01:00
Tom Christie
59b47eac14 Fix cache_throttle typo 2014-08-20 12:32:24 +01:00
Tom Christie
63d02dbea8 Drop six from compat. 1.4.2 is now the lowest supported version. 2014-08-19 17:06:55 +01:00
Tom Christie
5358243ca5 Merge pull request #1778 from linovia/bugfix/1398
Bugfix/1398
2014-08-19 16:16:02 +01:00
Tom Christie
2d2737f367 Resolve python3 linting issue 2014-08-19 14:11:26 +01:00
Tom Christie
d2795dd26d Resolve linting issues 2014-08-19 13:54:52 +01:00
Tom Christie
bf09c32de8 Code linting and added runtests.py 2014-08-19 13:28:07 +01:00
Xavier Ordoquy
c9535c036b Merged #1398 against 2.4 branch. 2014-08-19 11:12:36 +02:00
Tom Christie
e385a7b8eb Merge master 2014-08-19 10:11:10 +01:00
Paul Oswald
3e93c96ece replace unicode call with force_text 2014-08-19 10:09:48 +09:00
Tom Christie
97d8f037cc Only set .action attribute in override_method if it already existed on the view 2014-08-18 20:56:17 +01:00
Tom Christie
01986fc80e Merge pull request #1763 from fongandrew/patch-1
override_method should substitute action
2014-08-18 20:39:09 +01:00
Tom Christie
1d0c169e94 Merge pull request #1505 from ticosax/test.client.logout
reset stored credentials when call client.logout()
2014-08-18 20:37:25 +01:00
Tom Christie
c092b4df78 Merge pull request #1641 from javins/login-title
Refactor login template to extend base.
2014-08-18 20:28:34 +01:00
Tom Christie
3b899c9d57 Merge pull request #1726 from ikame/master
Leave status responsibility to parent class
2014-08-18 19:59:23 +01:00
Tom Christie
2aad8e4b35 Merge pull request #1654 from carltongibson/1559-take-2
Allow use of native migrations in 1.7 — Take 2
2014-08-18 18:54:43 +01:00
Tom Christie
e85ef3b479 Merge pull request #1772 from tomchristie/fix-1583
Copy filter_backends class attribute before returning it.
2014-08-18 16:14:45 +01:00
Tom Christie
9f3c7e8930 Copy filter_backends class attribute before returning it. 2014-08-18 15:34:23 +01:00
Tom Christie
33af92e019 Always uppercase X-Http-Method-Override methods. Closes #1718. 2014-08-18 15:14:30 +01:00
Tom Christie
8244c7cc33 Merge pull request #1711 from kdazzle/ModelViewSet-queryset-static-property
Issue #1707: Add documentation to api-docs.viewsets
2014-08-18 12:25:03 +01:00
Tom Christie
0e918055c7 Merge pull request #1739 from kevinlondon/patch-3
Updated documentation for urls.py
2014-08-18 12:15:32 +01:00
Andrew Fong
21cbf3484e Fixed action_map being pulled from wrong object 2014-08-16 23:22:18 +00:00
Andrew Fong
5f63d31b00 override_method should substitute action
A view's action is dependent on the request method. When overriding the method (e.g. to generate a form for a POST request on a GET call to the browseable API), the action should be updated as well. Otherwise, viewset functions may be in a weird limbo state where a 'list' action has a POST method.
2014-08-16 15:05:46 -07:00
Aymeric Derbois
a6901ea36d Add test for SerializerMethodField 2014-08-16 15:53:00 +02:00
John Whitlock
34c1da3515 ModelSerializer.restore_object - errors as list
When a ValueError is raised in ModelSerializer.restore_object, the error
is set to a one-element list, rather than a bare string.
2014-08-13 15:31:25 -05:00
Tom Christie
09c53bbac9 Refactor JSONRenderer slightly for easier overriding 2014-08-11 16:20:27 +01:00
Kevin London
aac864a55f Updated documentation for urls.py
I made a small change in the order of the documentation for urls.py. I feel it helps make it clear which lines you should add to the root settings.
2014-08-07 11:02:48 -07:00
Paul Oswald
192201d584 remove dep on python_2_unicode_compatible
python_2_unicode_compatible is not available in all Django versions
2014-08-07 15:48:29 +09:00
Kevin London
617745eca0 Update description of OrderingFilter
I added a brief description of how you could specify a different query parameter for the OrderingFilter.
2014-08-06 16:26:56 -07:00
Jason Alan Palmer
2d6469348d Remove duplicate class attributes
These duplicate attributes are ignored by at least Firefox and Chrome, so this change has no effect on the style
2014-08-05 10:25:48 -04:00
Anler Hp
ebcc78d96c Leave status responsibility to parent class
Django's `HttpResponse` class checks for the `status` param when it's
initialized, if it's `None` it uses the class attribute
`status_code` and thanks to that we can do things like:

```
class BadRequest(HttpResponse):
    status_code = 400
```

Now, that doesn't work when inheriting from rest-framework's `Response`:

```
class BadRequest(rest_framework.response.Response):
    status_code = 400  # Bad, it's always ignored
```

Because a default status of `200` is being specified in
`rest_framework.response.Response`. I think is more Django-friendly to
just leave that status default value to `None` and leave the
responsibility of choosing its value to the parent class: `HttpResponse`.
2014-08-01 10:20:10 +02:00
Paul Oswald
66fa40c300 evaluate content at function start 2014-07-29 22:13:11 +09:00
Xavier Ordoquy
5e02f015b8 Better fix for the Django 1.3 compat 2014-07-29 10:30:08 +02:00
Xavier Ordoquy
59d0a0387d Fixed the Django 1.3 compat 2014-07-29 10:20:10 +02:00
Xavier Ordoquy
4210fedd21 Fixed the cache issue with Django 1.7 rc* 2014-07-29 08:35:00 +02:00
Kyle
e40ffd60d4 Issue #1707 - Add documentation about the caching of GenericAPIView.queryset
to the `queryset` property, `get_queryset()`, and do generic-views.md; remove
changes to the viewsets.md documentation from my last commit.
2014-07-28 10:11:40 -07:00
Paul Oswald
921e4ed2ee Evaluate content before passing to regex.sub
Issue #1708
2014-07-28 16:59:55 +09:00
Xavier Ordoquy
c7a988eb38 Merge remote-tracking branch 'reference/master' 2014-07-28 07:53:04 +02:00
Xavier Ordoquy
fe048dc4fb Fix #1712 (issue when django-guardian is installed but not configured/used) 2014-07-28 07:37:30 +02:00
Xavier Ordoquy
4876bec9f5 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	rest_framework/fields.py
2014-07-26 00:06:56 +02:00
Ron Cohen
e3aff6a567 Updated test docstring related to missing bearer token. 2014-07-25 13:38:42 +00:00
Ron Cohen
05882cc599 Sending "Bearer" and "Bearer " resulted in a 500. 2014-07-25 10:55:53 +00:00
Serhiy Voyt
3326ddc865 Merge branch 'master' into modelserialization-charfield-with-null 2014-06-27 18:10:50 +03:00
Carlton Gibson
d98245ac22 Merge branch '2.4.0' of github.com:tomchristie/django-rest-framework into #1559
Conflicts:
	docs/topics/release-notes.md
2014-06-24 10:30:08 +02:00
Carlton Gibson
3f727ce738 Added (first pass) notes to docs & release notes. Backed out SOUTH_MIGRATION_MODULES setting from rest_framework.settings 2014-06-24 09:02:44 +02:00
Carlton Gibson
f34011f801 Allow use of native migrations in 1.7 2014-06-23 14:52:18 +02:00
Xavier Ordoquy
2489e38a06 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/viewsets.md
	rest_framework/serializers.py
	rest_framework/throttling.py
	tests/test_generics.py
	tests/test_serializers.py
	tox.ini
2014-06-23 14:02:45 +02:00
TankorSmash
544183f64f typo in the docs 2014-06-16 19:13:02 -04:00
Walt Javins
b4c7717cb8 Refactor login template to extend base.
While experimenting with extending DRF, I found that the login page
1) had no title, and 2) duplicated <head> info from base.html.

This change adds a new {% block body %} to the base.html template
which allows override of the entire html <body>. login_base.html
has its duplicated head info stripped, and now extends base.html
to share common html <head> templating.

As part of this change, pretify.css is unnecessarily added to
login_base.html.  If this is deemed a problem, it will be easy to
block that css out, and have login_base.html override the block.

Ideally, I would have liked to create a new api_base.html that extends
base.html, move the api specific logic into that template, and leave
base.html content agnostic, to truely be a unifying base for all DRF
pages.  But this change would break current apps that override
api.html and expect base.html to be the immediate super template. :/

This change is benificial because it:
 - removes duplication of header declarations (mostly css includes)
 - adds a html title to the login page
 - standardizes html header info across all DRF pages

Docs are updated to reflect the new structure.
2014-06-13 22:26:00 -07:00
Tom Christie
1386767013 Version 2.3.14 2014-06-12 11:47:26 +01:00
Xavier Ordoquy
e8ec81f5e9 Fixed #1624 (thanks @abraithwaite) 2014-06-08 09:03:21 +02:00
khamaileon
08c4594145 Replace ChoiceField type_label 2014-06-05 12:49:02 +02:00
Danilo Bargen
6cb6bfae1b Always use specified content type in APIRequestFactory
If `content_type` is specified in the `APIRequestFactory`, always
include it in the request, even if data is empty.
2014-05-30 17:53:26 +02:00
khamaileon
eab5933070 Add the allow_add_remove parameter to the get_serializer method 2014-05-26 18:43:50 +02:00
Piper Merriam
807f7a6bb9 Fix _resolve_model to work with unicode strings 2014-05-22 15:18:51 -06:00
John Spray
04c820b8e5 fields: allow help_text on SerializerMethodField
...by passing through any extra *args and **kwargs
to the parent constructor.

Previously one couldn't assign help_text to a
SerializerMethodField during construction.
2014-05-22 15:24:35 +01:00
Tom Christie
218b94e606 Merge pull request #1536 from Ian-Foote/choicefield_blank_display_value
Allow customising ChoiceField blank display value
2014-05-20 16:03:51 +01:00
allenhu
a1a3ad7639 fix pep8 2014-05-19 09:53:05 +08:00
Xavier Ordoquy
5c12b07681 Added missing import. 2014-05-16 19:40:02 +02:00
Xavier Ordoquy
a704d5a206 Fixed tests for python 3.4 2014-05-16 01:20:40 +02:00
Carlton Gibson
d69d975015 Merge pull request #1564 from alumni/master
Fixes #1535 (HTML widget missing `id` attribute)
2014-05-09 10:36:06 +02:00
Carlton Gibson
0ff474d7c4 Updated failing test from #1575 2014-05-08 11:20:03 +02:00
Carlton Gibson
591d5240da Merge pull request #1575 from ewdicus/iso8601
Add colon to time zone offset in readable_datetime_formats
2014-05-08 09:34:06 +02:00
Elliott
11115fde9c Add colon to time zone offset in readable_datetime_formats 2014-05-07 11:37:20 -07:00
Serhiy Voyt
4e6a21344f Fixed test. 2014-05-07 18:42:02 +03:00
Serhiy Voyt
27be31bd8a In case of None value returns empty string instead of NoneType. 2014-05-07 18:37:08 +03:00
Serhiy Voyt
1ce1f387b0 Charfied from_native method returns default instead of None. Updated tests. 2014-05-06 21:57:25 +03:00
Serhiy Voyt
98cc821099 Extended test with case of saveing model with blank not null field. 2014-05-06 20:34:30 +03:00
Lucian Mocanu
708c7b3a81 Added test case to check if the proper attributes are set on html widgets. 2014-05-06 14:17:51 +02:00
Carlton Gibson
8e78a38de5 Merge pull request #1485 from Atrasoftware/master
Use help_text, verbose_name, editable attributes for related fields
2014-05-06 13:43:15 +02:00
Lucian Mocanu
4e33ff05d9 Automatically set the field name as value for the HTML id attribute on the rendered widget. 2014-05-04 00:12:08 +02:00
Charlie Denton
ccf3c508bd Fix missing message in ValidationError 2014-05-02 21:58:49 +01:00
Charlie Denton
c15dab903d Mark strings in AuthTokenSerializer as translatable 2014-05-01 10:18:16 +01:00
Xavier Ordoquy
7b4463f739 Merge remote-tracking branch 'reference/2.4.0' into feature/pytest
Conflicts:
	rest_framework/runtests/urls.py
	tests/test_response.py
	tox.ini
2014-05-01 08:01:38 +02:00
Xavier Ordoquy
c9e6f31166 Fixed new default for many 2014-05-01 01:27:51 +02:00
Xavier Ordoquy
38362bb43a Fixed new default for many 2014-05-01 01:24:48 +02:00
Xavier Ordoquy
7475fceacc Added missing field for the tests. 2014-05-01 00:54:20 +02:00
Xavier Ordoquy
cd93cd195e Use url functions from Django itself. 2014-04-30 22:32:29 +02:00
Xavier Ordoquy
2aca69a946 Merge remote-tracking branch 'reference/master' into feature/pytest
Conflicts:
	tests/test_serializer.py
2014-04-30 22:24:01 +02:00
Xavier Ordoquy
56b4390316 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	.travis.yml
	rest_framework/serializers.py
	rest_framework/tests/test_authentication.py
2014-04-30 22:21:26 +02:00
Xavier Ordoquy
5333a93126 Merge pull request #1409 from tuky/patch-1
remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
2014-04-30 21:38:21 +02:00
Emanuele Pucciarelli
295a4ab62d Added help_text to expected response in test 2014-04-29 22:16:11 +02:00
Emanuele Pucciarelli
fc44cd8d6a Sync test result w/ new label 2014-04-29 21:45:57 +02:00
Emanuele Pucciarelli
f54399ea77 Merge remote-tracking branch 'upstream/master'
Conflicts:
	rest_framework/tests/models.py
2014-04-29 21:41:53 +02:00
Tom Christie
1085b64fec Merge pull request #1543 from sinitsynsv/master
Add help_text and verbose_name attribute mapping for related field
2014-04-28 20:23:12 +01:00
Max Peterson
73597a16a2 Better Python < 3 compatibility. 2014-04-28 13:13:51 +01:00
Max Peterson
170fa10ae0 Python < 3 compatibility. 2014-04-28 13:10:34 +01:00
Max Peterson
1c777ffe8b Ensure Token.generate_key returns a string. 2014-04-28 12:35:55 +01:00
Kamil Niski
82094554e5 Minor typo 2014-04-27 02:54:47 +02:00
Sergey Sinitsyn
a6e525cf3a Add help_text and verbose_name attribute mapping for related field 2014-04-24 15:58:53 +06:00
Xavier Ordoquy
1797a74e82 Merge remote-tracking branch 'pelme/pytest' into feature/pytest
Conflicts:
	.travis.yml
	rest_framework/runtests/runtests.py
	tests/test_filters.py
	tests/test_pagination.py
	tox.ini
2014-04-17 09:53:44 +02:00
Ian Foote
6c108c459d Allow customising ChoiceField blank display value 2014-04-16 12:32:04 +01:00
Xavier Ordoquy
1d404874b3 Merge pull request #1527 from Ian-Foote/generic_foreign_key
Set GenericForeignKey fields on object before save
2014-04-16 11:27:06 +02:00
Carlton Gibson
03b4c60b2d Merge pull request #1518 from hroncok/patch-1
Add more TRAILING_PUNCTUATION to work with YAML
2014-04-15 15:59:25 +02:00
Miro Hrončok
ef1d652827 Introduce tests for urlize_quoted_links() function 2014-04-15 15:33:14 +02:00
Carlton Gibson
c93ddf1750 Merge pull request #1520 from hroncok/patch-2
Allow unicode YAML dump
2014-04-15 15:13:51 +02:00
Miro Hrončok
617c982591 Add test for UnicodeYAMLRenderer 2014-04-15 14:12:09 +02:00
Vladislav Vlastovskiy
3fe0383572 Fixed convert bytes to str
Use compact function for convert
2014-04-14 13:21:24 +04:00
Vladislav Vlastovskiy
d1f4dfca20 Removed decode from test filename 2014-04-14 13:04:18 +04:00
Vladislav Vlastovskiy
d474934d36 Fixed return type
From bytes to str
2014-04-14 13:01:24 +04:00
Vladislav Vlastovskiy
063addabfe Removed encode from test
Django does not produce such a decoding by default, this test was not honest.
2014-04-14 12:28:41 +04:00
Vladislav Vlastovskiy
4b3eb6e0b0 Fixed parse file name 2014-04-14 12:21:38 +04:00
Ian Foote
853c7a16c1 Use setattr for adding fields to a new instance
Add test for restoring a GenericForeignKey
2014-04-13 17:33:45 +01:00
Xavier Ordoquy
d08536ad9d Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/fields.md
	docs/api-guide/routers.md
	docs/topics/release-notes.md
	rest_framework/authentication.py
	rest_framework/serializers.py
	rest_framework/templatetags/rest_framework.py
	rest_framework/tests/test_authentication.py
	rest_framework/tests/test_filters.py
	rest_framework/tests/test_hyperlinkedserializers.py
	rest_framework/tests/test_serializer.py
	rest_framework/tests/test_testing.py
	rest_framework/utils/encoders.py
	tox.ini
2014-04-13 00:05:57 +02:00
Ian Foote
0a0e4f22e7 Set GenericForeignKey fields on object before save
* A model with a required GenericForeignKey can be saved if the field is set
2014-04-12 17:51:02 +01:00
Ian Leith
613df5c650 Fix dict_keys equality test for python 3. 2014-04-11 05:49:49 +01:00
Miro Hrončok
7ae8409370 Allow unicode YAML dump with UnicodeYAMLRenderer
Fixes #1519
2014-04-10 01:47:30 +02:00
Miro Hrončok
a23059b6f7 Add more TRAILING_PUNCTUATION to work with YAML.
Fixes #1517
2014-04-09 23:35:41 +02:00
Carlton Gibson
a73498d797 Skip new test for Django < 1.6 2014-04-09 19:54:13 +02:00
Carlton Gibson
645ef9895f Merge branch 'refs/heads/master' into #1408 2014-04-09 15:52:26 +02:00
Carlton Gibson
c1ac65edce Adds test that blank option is added when required=False on RelatedFields 2014-04-09 15:51:00 +02:00
Mauro de Carvalho
2a1571b3bf Fixed comment. 2014-04-07 18:27:59 -03:00
Dmitry Mukhin
c3891b6e00 set Retry-After header when throttled 2014-04-07 20:31:12 +04:00
Nicolas Delaby
af8a362d6b reset stored credentials when call client.logout() 2014-04-07 14:59:27 +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
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
Emanuele Pucciarelli
8904f179d1 Stray unicode string marker removed 2014-03-30 12:06:03 +02:00
Emanuele Pucciarelli
d8bf878792 Metadata for related fields -- added test case. 2014-03-30 11:48:17 +02:00
Emanuele Pucciarelli
ab5082d15c Do not check model_field's attributes if it is None 2014-03-28 19:42:46 +01:00
Emanuele Pucciarelli
04315c12af Use help_text, verbose_name, editable attributes for related fields 2014-03-24 19:25:28 +01:00
Daniel Kontsek
3b71be725a Fixed encoding parameter in QueryDict 2014-03-22 10:32:59 +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
Xavier Ordoquy
0e677e9dd1 Reintroduced url arguments in the urls for the tests. 2014-03-07 16:11:51 +01:00
Tom Christie
3fa95132d8 Don't barf if PIL is not installed. 2014-03-07 14:16:14 +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
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
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
David Larlet
84e7bf6796 Update documentation of render methods (obj to data) 2014-03-04 17:21:07 +01:00
David Larlet
07cb436d61 Typo in keywords arguments name
Because it matters ;)
2014-03-04 16:32:34 +01:00
Tom Christie
4edd39b2e4 Merge pull request #1442 from Anton-Shutik/master
RelatedField default value handling fixed
2014-03-04 15:26:34 +00:00
Anton Shutik
dea2766aba Added tests for "get_default_value" function 2014-03-04 13:11:54 +03:00
Xavier Ordoquy
3d7cb72e0a Merge remote-tracking branch 'reference/master' into feature/django_1_7 2014-03-03 11:41:07 +01:00
Andreas Pelme
971578ca34 Support for running the test suite with py.test
* Get rid of runtests.py
 * Moved test code  from rest_framework/tests and rest_framework/runtests to tests
 * Invoke py.test from setup.py
 * Invoke py.test from Travis
 * Invoke py.test from tox
 * Changed setUpClass to be just plain setUp in test_permissions.py
 * Updated contribution guideline to show how to invoke py.test
2014-03-02 12:40:30 +01:00
hongfeiZhang
693d9d9c63 In the method permission_denied, did not use the request parameter. 2014-03-01 11:37:31 +08:00
Tom Christie
22f225175f Merge pull request #1437 from Keats/master
Display the media type of the API response on the browsable API
2014-02-28 11:55:45 +00:00
Anton Shutik
3c62f0efc3 RelatedField.get_default_value: return empty list if self.many==True 2014-02-28 13:59:21 +03:00
Tom Christie
c3c69f4304 Merge pull request #1441 from dustinfarris/null-serialization
TestCases and POST/PUT'ing serialized data that contains `None`
2014-02-28 09:27:27 +00:00
Val Neekman
818b4bf8b3 handle negative time value and prevent a divide by zero 2014-02-27 12:27:54 -08:00
Dustin Farris
f126856f65 Allow 'None' to pass as a null value in RelatedFields 2014-02-27 12:30:59 -05:00
Anton Shutik
1addd09e2b RelatedField default value handling fixed 2014-02-27 18:34:36 +03:00
Keats
6cd0394e20 Display the media type of the API response on the browsable API 2014-02-26 23:47:35 +00:00
Dustin Farris
505f1173d0 Demonstrate problem post/put'ing serialized data that contains 'None' 2014-02-26 12:08:26 -05:00
Tom Christie
d328f1827d Tweak comment wrapping. 2014-02-18 12:30:55 +00:00
Ian Foote
dca8b98356 Remove unnecessary else 2014-02-18 12:28:02 +00:00
Ian Foote
f22aeeb0a3 Refactor UpdateModelMixin.update
Reduce nesting, return early in error cases.
2014-02-18 12:08:12 +00:00
Xavier Ordoquy
b2f0f4fcf4 Merge remote-tracking branch 'reference/master' into feature/django_1_7 2014-02-18 11:42:35 +01:00
Xavier Ordoquy
5ae94547bc Moved the python_2_unicode_compatible into compat module. 2014-02-18 11:42:17 +01:00
tuky
5e4336845f Update throttling.py
python 3 u'' gone
2014-02-14 13:47:17 +01:00
Tom Christie
a06252f812 Merge pull request #1397 from amezhenin/issue_1386
update regex for matching URLs, fixes issue #1386
2014-02-13 16:27:19 +00:00
Artem Mezhenin
dbd993d108 wrapper for smart_urlquote, issue #1386 2014-02-13 20:14:47 +04:00
Artem Mezhenin
08ec23268d (I hope) tests are fixed, issue #1386 2014-02-13 19:39:53 +04:00
Artem Mezhenin
d00ea3bcac change regex back, issue #1386 2014-02-13 18:59:05 +04:00
tuky
d18d32669a remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
memcached cannot handle spaces in keys
2014-02-12 18:11:18 +01:00
Carlton Gibson
f1016441f5 Test and fix for #1210. World's lowest hanging fruit. 2014-02-11 19:52:32 +01:00
Carlton Gibson
95670933d7 Test and quick fix for #1257 2014-02-11 14:44:56 +01:00
Hassan Shamim
97b7c25987 Replace 'detail' with 'default_detail' in Exceptions guide and APIException class docstring. 2014-02-10 12:54:56 -06:00
Simon Charette
4d45865bd7 Allow filter model to be a subclass of the queryset one. 2014-02-09 00:50:03 -05:00
Artem Mezhenin
35f4908e48 issue #1386
* regex for matching URLs was rewritten
* added unittests
2014-02-09 02:46:25 +04:00
Artem Mezhenin
41eb313e1c update regex for matching URLs, fixes issue #1386 2014-02-09 01:01:05 +04:00
Matthew King
f8cda8adbd Generate random token directly 2014-02-04 22:50:11 -05:00
juroe
b182b9e246 Fixes typo (Implicit instead of Implict). 2014-02-04 11:56:41 +01:00
Tom Christie
8f921160e5 Merge pull request #1377 from Ian-Foote/force_bytes
Import force_bytes on django >= 1.5
2014-01-31 03:45:04 -08:00
Xavier Ordoquy
5a662dd60e Moving models back to test_serializer. 2014-01-31 11:20:53 +01:00
Ian Foote
0043f30cab Use bytes BOUNDARY on django < 1.5
Django's encode_multipart was updated in django 1.5 to work internally
with unicode and convert to bytes.

In django >= 1.5 we therefore need to pass the BOUNDARY as unicode. In
django < 1.5 we still need to pass it as bytes.
2014-01-31 09:12:45 +00:00
Tom Christie
18f26ff5cc Only add 'Vary: Accept' header when there is more than one possible renderer. 2014-01-30 17:47:55 +00:00
Tom Christie
9f0ead9597 Remove TODO note, since it hasn't been TODONE. 2014-01-30 17:32:05 +00:00
Xavier Ordoquy
73e5b7e4b2 Fixed the object representation in order to pass the tests. 2014-01-30 14:27:46 +01:00
Xavier Ordoquy
c2ee52239d Refactoring due to the previous commit. 2014-01-30 14:27:09 +01:00
Xavier Ordoquy
1319da59ce Make factory.get work with Django 1.7 2014-01-30 14:26:21 +01:00
Xavier Ordoquy
c6d89afdf7 Define the upload_to for file fields. 2014-01-28 23:43:09 +01:00
Xavier Ordoquy
e4c25e0ff2 wsgi_request is now added to the response so we have to remove it before pickling the response. 2014-01-28 18:57:36 +01:00
Xavier Ordoquy
656117814c Django 1.7 has new 404 and 403 body messages. 2014-01-28 18:55:29 +01:00
Xavier Ordoquy
23a20160c4 Mock updated as Django’s get_template now has two arguments. 2014-01-28 18:54:49 +01:00
Xavier Ordoquy
da89cfc937 Don’t rely on Django’s get as it breaks for 1.7 2014-01-28 18:53:58 +01:00
Xavier Ordoquy
6aadd1639b Moved all the reused models to the models files to avoid conflicts with the refactored apps. 2014-01-28 18:53:24 +01:00
Ian Foote
78e4468f03 Add file upload test for APIRequestFactory
Remove test_compat
2014-01-28 15:54:50 +00:00
Ian Foote
74fec7eeb4 Import force_bytes on django >= 1.5 2014-01-28 14:30:46 +00:00
Xavier Ordoquy
7713ddc0a8 Don’t forget to setup django for 1.7+ as it’s not a regular django command. 2014-01-28 13:20:51 +01:00
Rodolfo Henrique Carvalho
c436725dd6 Fix typo in docstring for post_delete hook. 2014-01-25 23:58:42 +01:00
Tom Christie
47f5bd488d Merge pull request #1361 from ross/x_method_override
always obey X-HTTP-METHOD-OVERRIDE header
2014-01-17 08:19:06 -08:00
Ross McFarland
58d77c11c3 always obey X-HTTP-METHOD-OVERRIDE header
required to support old flash/flex clients that need to do everything as
GET requests (apparently to allow for any error handlings)
2014-01-17 08:14:05 -08:00
Mathieu Pillard
f034cb595a Encode django QuerySets to lists and not dicts in JSONEncoder 2014-01-17 13:05:10 +01:00
Tom Christie
71c03b9db9 Security update to OrderingFilter 2014-01-15 14:27:41 +00:00
Tom Christie
e9fda70b4a Nicer write_only fields implementation. Closes #1355 2014-01-15 08:53:23 +00:00
Tom Christie
8f6983ee6e Merge branch 'master' of git://github.com/sprymak/django-rest-framework into sprymak-master 2014-01-14 20:35:26 +00:00
Tom Christie
dde3b1dfcb Use api_settings.URL_FIELD_NAME 2014-01-14 20:35:09 +00:00
S.Prymak
ed8143b2b0 Test for customizable HyperlinkedModelSerializer url field name 2014-01-14 13:58:17 +02:00
Tom Christie
97f8ede4d1 Version 2.3.11 2014-01-14 11:26:10 +00:00
Tom Christie
85d74fc86a Added write_only and write_only_fields. Refs #1306 2014-01-14 11:25:44 +00:00
S.Prymak
e9b0d70f5d Override HyperlinkedModelSerializerOptions url field name with URL_FIELD_NAME setting 2014-01-14 10:38:49 +02:00
Tom Christie
bc6c5df109 Minor tweaks 2014-01-13 17:39:22 +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
Tom Christie
d937ce331c Minor cleanup 2014-01-13 17:37:08 +00:00
Dustin Farris
c4d77667cf Move ImportingModelSerializerTests and add comments. 2014-01-13 12:03:13 -05:00
Tom Christie
73d8a2bcbd Merge branch 'master' of git://github.com/cguethle/django-rest-framework into cguethle-master 2014-01-13 16:52:19 +00:00
Dustin Farris
b1b58762a3 Move models.resolve_model to serializers._resolve_model 2014-01-13 11:47:44 -05:00
Tom Christie
2911cd64ad Minor tweaks to 'lookup_value_regex' work 2014-01-13 15:37:52 +00: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
S.Prymak
65858428fd Make HyperlinkedModelSerializer url field name customizable 2014-01-13 16:35:20 +02: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
cd9a4194ea Check the modelfield's class instead 2014-01-12 16:32:36 +02:00
Yuri Prezument
0fd0454a5c Test for setting allow_none=True for nullable CharFields 2014-01-12 10:53:54 +02:00
Yuri Prezument
e1bbe9d514 Set allow_none = True for CharFields with null=True 2014-01-12 10:53:54 +02:00
Yuri Prezument
6e622d644c CharField - add allow_null argument 2014-01-12 10:53:54 +02:00
Yuri Prezument
e88e3c6ae1 Possible fix for #1330
Coerce None to '' in CharField.to_native()
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
f217f6870d Removed useless try/except 2014-01-09 23:32:50 +01: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
Tom Christie
c6182b78e5 Merge pull request #1341 from fredrikmollerstrand/docstring-typo-fix
fix docstring typos.
2014-01-09 07:51:02 -08:00
Fredrik Möllerstrand
82a48ca55e fix docstring typos. 2014-01-09 15:41:20 +00:00
Dustin Farris
52db4eadc2 Testing nested serializers with models that have str foreign key references. 2014-01-08 16:14:27 -05:00
Tom Christie
78494401c5 Use www.django-rest-framework.org for docs instead of django-rest-framework.org due to issues with naked domains 2014-01-08 15:22:41 +00:00
Tom Christie
e3ae33017d Added "nofollow" against docs link. 2014-01-06 15:01:45 +00: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
Steven Cummings
e020c51b44 FIX BaseSerializer.from_native has an altered signature
* base classes define it with one parameter
* BaseSerializer currently defines a second parameter, which we make optional here for method-dispatch passivity
2014-01-02 17:18:08 -06:00
S. Andrew Sheppard
d30ce2575c fix for genericrelation saving 2013-12-23 22:31:31 -06: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
amatellanes
2d6d725c2f Simplified some functions 2013-12-22 12:39:47 +01: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
Tom Christie
a439c80cd8 Less brittle through relationship testing. Closes #1292. 2013-12-21 21:21:53 +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
Tom Christie
0f37260254 Merge pull request #1184 from dpetzel/nullbooleanfield_fix
Fix infered field type for models.NullBooleanField
2013-12-16 05:50:10 -08:00
Tom Christie
4bc829d4e9 Merge pull request #1298 from craigds/fix-nested-serializers-with-renamed-fields
Fix nested serializers with renamed fields
2013-12-16 01:18:31 -08:00
Tom Christie
fc2dee844a Don't import compat.py from authtoken.models. Closes #1297 2013-12-16 08:59:10 +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
Tom Christie
193af483ef Add notes on lookup_prefix argument and why it's there even though unused by the default implementations. 2013-12-13 20:22:56 +00:00
Tom Christie
fbaba0a309 Merge pull request #1281 from alanjds/router-prefix-patch
'lookup_prefix' on SimpleRouter.get_lookup_regex, easing code de-duplication
2013-12-13 12:19:49 -08: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
0453cbd56b Clean up implementation 2013-12-13 11:09:54 +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
83da4949c0 Allow NUM_PROXIES=0 and include more docs 2013-12-13 00:02:18 +00: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
kahnjw
23db6c9849 PEP8 Compliance 2013-12-06 14:52:39 -08:00
kahnjw
89f26c5e04 Add get_ident method to pass new tests. 2013-12-06 14:21:52 -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
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
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