Commit Graph

443 Commits

Author SHA1 Message Date
Tom Christie
3e878a3207 Fix initial data on serializers to reflect writable fields 2014-11-07 15:38:27 +00:00
Tom Christie
55c44fc921 Fix serializer initial data 2014-11-07 14:13:50 +00:00
Tom Christie
e399140031 Minor tweaks 2014-11-07 10:51:08 +00:00
Tom Christie
9b19b5a594 Serializer cleanup 2014-11-07 10:13:46 +00:00
Tom Christie
4e001dbb7a Drop usage of SortedDict. Closes #2027. 2014-11-06 12:00:30 +00:00
Tom Christie
a919068c5d Fix exception style for py3 2014-11-06 11:35:34 +00:00
Tom Christie
4482be46ae More precise assertion error for bulk update 2014-11-06 11:10:36 +00:00
Tom Christie
ed541864e6 Support for bulk create. Closes #1965. 2014-11-06 10:34:59 +00:00
Tom Christie
49fae23000 Pass through kwargs to both Serializer and ListSerializer 2014-11-05 15:23:13 +00:00
Tom Christie
d048d32876 Minor cleanup 2014-11-05 13:40:21 +00:00
Tom Christie
003c42b0f5 Use invalid_data key for error message. Closes #2002. 2014-11-03 14:01:02 +00:00
Tom Christie
207208fedf Lazy loading of fields and validators. Closes #1963. 2014-10-31 16:38:39 +00:00
Tom Christie
2762205887 Validator documentation and tweaks 2014-10-31 13:47:36 +00:00
Tom Christie
9ebaabd6eb unique_for_date/unique_for_month/unique_for_year 2014-10-28 16:21:49 +00:00
Tom Christie
f9c0e6ee1b unique_for_month, unique_for_year 2014-10-22 16:29:09 +01:00
Tom Christie
ae53fdff9c First pass at unique_for_date, unique_for_month, unique_for_year 2014-10-22 13:30:28 +01:00
Tom Christie
c5d1be8eac .validate() can raise field errors or non-field errors 2014-10-22 10:32:32 +01:00
Tom Christie
05cbec9dd7 Use serializers.ValidationError 2014-10-17 13:23:14 +01:00
Tom Christie
32fd82ba0d get_attribute method on fields 2014-10-16 20:47:57 +01:00
Tom Christie
7b666e982c Stricter checking for failure cases. 2014-10-16 20:47:57 +01:00
Marty Alchin
4248a6c499 Add a keys method to BindingDict 2014-10-15 17:54:58 -07:00
Tom Christie
b4f3379c70 Support fields that reference a simple callable 2014-10-15 15:13:28 +01:00
Tom Christie
e272a36c9b Fix 'lookup_field' on ModelSerializer. Closes #1944. 2014-10-15 09:24:49 +01:00
Tom Christie
826b5a8897 Relations in 'read_only_fields' should not include a queryset kwarg 2014-10-10 15:34:00 +01:00
Tom Christie
b5a4216aff Flake8 2014-10-10 15:08:43 +01:00
Tom Christie
d8a8987ab1 Tweaks 2014-10-10 14:32:02 +01:00
Tom Christie
d9a199ca0d exceptions.ValidationFailed, not Django's ValidationError 2014-10-10 14:16:09 +01:00
Tom Christie
f83ed19d22 Checks and repr on BoundField 2014-10-09 16:29:34 +01:00
Tom Christie
5d247a65c8 First pass on nested serializers in HTML 2014-10-09 15:11:19 +01:00
Tom Christie
14ae52a24e More gradual deprecation 2014-10-08 16:09:37 +01:00
Tom Christie
28f3b314f1 .validate() returning validated data. transform_<field> hooks. 2014-10-08 12:36:28 +01:00
Tom Christie
0cbb57b40f Tweak pre/post save hooks. Return instance in .update(). 2014-10-08 12:17:30 +01:00
Tom Christie
6b09e5f2bb Tests for generic relationships 2014-10-08 11:22:10 +01:00
Tom Christie
3a3e2bf57d Serializer.save() takes keyword arguments, not 'extras' argument 2014-10-03 13:42:06 +01:00
Tom Christie
e6c5ebdda6 Fix indentation 2014-10-03 13:14:17 +01:00
Tom Christie
fec7c4b458 Browsable API tweaks 2014-10-02 18:13:15 +01:00
Tom Christie
df7b6fcf58 First pass on incorperating the form rendering into the browsable API 2014-10-02 16:24:24 +01:00
Tom Christie
c171fa21ac First pass at HTML form rendering 2014-10-01 19:44:46 +01:00
Tom Christie
d1b2c8ac7f Absolute URLs for file fields 2014-09-29 14:12:26 +01:00
Tom Christie
9805a085fb UniqueTogetherValidator 2014-09-29 11:23:02 +01:00
Tom Christie
6090144608 Simplify serialization slightly 2014-09-26 14:32:44 +01:00
Tom Christie
2e87de0143 Added ListField 2014-09-26 13:08:20 +01:00
Tom Christie
8b8623c5f8 Allow many, partial and context in BaseSerializer 2014-09-26 12:48:20 +01:00
Tom Christie
43e80c74b2 Release notes 2014-09-26 11:56:29 +01:00
Tom Christie
2859eaf524 request.data attribute 2014-09-26 10:46:52 +01:00
Tom Christie
417fe1b675 Partial support 2014-09-25 13:37:26 +01: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
b22c9602fa Automatic field binding 2014-09-25 11:04:18 +01:00
Tom Christie
f4b1dcb167 OPTIONS support 2014-09-24 14:09:49 +01:00
Tom Christie
0404f09a7e NullBooleanField 2014-09-23 14:30:17 +01:00
Tom Christie
f22d0afc3d Tests for field choices 2014-09-23 14:15:00 +01:00
Tom Christie
cf72b9a8b7 Moar tests 2014-09-19 16:43:13 +01:00
Tom Christie
f90049316a Added a model update integration test 2014-09-18 15:47:27 +01:00
Tom Christie
106362b437 ModelSerializer.create() to handle many to many by default 2014-09-18 14:58:08 +01:00
Tom Christie
87734be5f4 Configuration correctness tests on ModelSerializer 2014-09-18 12:17:21 +01:00
Tom Christie
5b7e4af0d6 get_base_field() refactor 2014-09-18 11:20:56 +01:00
Tom Christie
c0155fd9dc Update comments 2014-09-17 14:11:53 +01:00
Tom Christie
d196608d5a Fix nested model serializer base class 2014-09-15 13:55:09 +01:00
Tom Christie
40dc588a37 Drop label from serializer fields when not needed 2014-09-15 09:50:51 +01:00
Tom Christie
afb28a44ad Dealing with reverse relationships 2014-09-12 21:32:20 +01:00
Tom Christie
6db3356c4d NON_FIELD_ERRORS_KEY setting 2014-09-12 10:21:35 +01:00
Tom Christie
0d354e8f92 to_internal_value() and to_representation() 2014-09-12 09:49:35 +01:00
Tom Christie
adcb64ab41 MethodField -> SerializerMethodField 2014-09-12 09:12:56 +01:00
Tom Christie
ab40780dc2 Tidy up lookup_class 2014-09-11 20:22:32 +01:00
Tom Christie
de301f3b66 Merge master 2014-09-11 13:20:44 +01:00
Tom Christie
80ba047347 Compat fixes 2014-09-10 16:57:22 +01:00
Tom Christie
01c8c0cad9 Added help_text argument to fields 2014-09-10 13:52:16 +01:00
Tom Christie
234369aefd Tweaks 2014-09-10 08:53:33 +01:00
Tom Christie
b1c07670ca Fleshing out serializer fields 2014-09-09 17:46:28 +01:00
Tom Christie
21980b800d More test sorting 2014-09-08 14:24:05 +01:00
Tom Christie
d934824bff Workin on 2014-09-05 16:29:46 +01: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
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
Tom Christie
4ac4676a40 First pass 2014-08-29 16:46:26 +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
bf09c32de8 Code linting and added runtests.py 2014-08-19 13:28:07 +01:00
Tom Christie
e385a7b8eb Merge master 2014-08-19 10:11:10 +01: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
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
Piper Merriam
807f7a6bb9 Fix _resolve_model to work with unicode strings 2014-05-22 15:18:51 -06: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
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
Emanuele Pucciarelli
f54399ea77 Merge remote-tracking branch 'upstream/master'
Conflicts:
	rest_framework/tests/models.py
2014-04-29 21:41:53 +02:00
Sergey Sinitsyn
a6e525cf3a Add help_text and verbose_name attribute mapping for related field 2014-04-24 15:58:53 +06: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
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
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
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
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