Commit Graph

28 Commits

Author SHA1 Message Date
Xavier Ordoquy
5068ecf64b Rename the get_queryset overriding test. 2016-01-21 16:50:07 +01:00
Xavier Ordoquy
6d95da7b2d Improve the get_queryset overriding test readability. 2016-01-21 16:48:32 +01:00
Xavier Ordoquy
f1b28b4d63 Merge pull request #3605 from ryanhiebert/slug-related-field-queryset
RelatedField get_queryset and context
2016-01-20 18:17:29 +01:00
Luis San Pablo
4b59681c60 Fixed Class Newlines 2015-12-04 05:57:09 +00:00
Luis San Pablo
4092cef392 Fixed Test Case for Hyperlink 2015-12-04 05:42:46 +00:00
Luis San Pablo
8501f59216 Hyperlink Test Case 2015-12-04 05:30:39 +00:00
Ryan Hiebert
f2452936e9 Allow no queryset when get_queryset overridden
The user may wish to provide a dynamic queryset on a `RelatedField`
based on the `context`. The way to do that is to create a subclass of
`RelatedField` (or a child) and override the `get_queryset` method.
However, this is undocumented, and instantiating that field without a
`queryset` argument (because it's not needed) will raise an assertion
error.

Document `.get_queryset(self)` as an official part of the API of
`RelatedField`, and don't enforce the use of `queryset` when
`get_queryset` is overridden.
2015-11-05 17:34:02 -06:00
José Padilla
7351a3f6ca Sort imports with isort 2015-06-25 16:55:51 -04:00
Brian Grohe
d24990ece2 Fixed many=False issue in related fields
Added check to pop many from kwargs before passing to __init__
Fixed my lint issue from the previous commit
2015-06-17 13:48:34 -04:00
Brian Grohe
79736e516a Added failing test case
Adding failing test case when many=false is explicitly defined

https://github.com/tomchristie/django-rest-framework/issues/3042
2015-06-17 13:18:50 -04:00
Thomas Stephenson
a1e0bae9da Custom serialization of PrimaryKeyRelatedField values
Adds a 'pk_field' parameter which can be used to proxy serialization and
deserialization of arbitrary primary key values.
2015-06-15 04:43:49 +10:00
Tom Christie
4ee4b4f2dc Merge master 2015-01-30 14:00:25 +00:00
Susan Dreher
e7da266a86 reorganize imports 2015-01-27 16:32:15 -05:00
Susan Dreher
1714ceae9f reorganize imports 2015-01-27 16:31:25 -05:00
Susan Dreher
8c3f82fb18 🐛 ManyRelatedField get_value clearing field on partial update
A PATCH to a serializer's non-related CharField was clearing an ancillary StringRelatedField(many=True) field.
The issue appears to be in the ManyRelatedField's get_value method, which was returning a [] instead of empty
when the request data was a MultiDict.

This fix mirrors code in fields.py, class Field, get_value, Ln. 272, which explicitly returns empty on a partial update.

Tests added to demonstrate the issue.
2015-01-27 16:18:51 -05:00
Craig Blaszczyk
91e316f781 prefer single quotes in source and double quotes in user visible strings; add some missing full stops to user visible strings 2015-01-07 12:46:23 +00:00
Tom Christie
c8764de788 Drop defunct tests 2014-11-28 13:04:42 +00:00
Tom Christie
05cbec9dd7 Use serializers.ValidationError 2014-10-17 13:23:14 +01:00
Tom Christie
d9a199ca0d exceptions.ValidationFailed, not Django's ValidationError 2014-10-10 14:16:09 +01:00
Craig de Stigter
dfab9af294 Minor: fix spelling and grammar, mostly in 3.0 announcement 2014-10-03 08:41:18 +13:00
Tom Christie
64632da371 Clean up bind - no longer needs to be called multiple times in nested fields 2014-09-25 11:40:32 +01:00
Tom Christie
1f75ffc791 Access validation messages in a way thats compatible with 1.4, 1.5 2014-09-12 19:50:30 +01:00
Tom Christie
b73a205cc0 Tests for relational fields (not including many=True) 2014-09-12 17:03:42 +01:00
Tom Christie
b1c07670ca Fleshing out serializer fields 2014-09-09 17:46:28 +01:00
Tom Christie
f2852811f9 Getting tests passing 2014-09-02 17:41:23 +01:00
Tom Christie
bf09c32de8 Code linting and added runtests.py 2014-08-19 13:28:07 +01: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
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