Commit Graph

1664 Commits

Author SHA1 Message Date
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
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
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
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