Tom Christie
c611a2c1fe
Merge pull request #2213 from BrickXu/master
...
Raise error if `fields` on serializer is not a list of strings.
2014-12-05 14:00:59 +00:00
Tom Christie
88900a0844
Minor tweaks
2014-12-05 13:58:39 +00:00
Tom Christie
ca74fa989d
Better serializer errors for nested writes. Closes #2202
2014-12-05 13:50:28 +00:00
BrickXu
d68c614504
Add validation for fields & exclude type.
2014-12-05 14:51:39 +08:00
Tymur Maryokhin
d9930181ee
Removed unused imports, pep8 fixes, typo fixes
2014-12-05 00:29:28 +01:00
Tom Christie
f221b737a1
Merge pull request #2197 from mtschammer/mtschammer-validated_attrs-rename
...
Renamed validated_attrs to validated_data to be more in line with other code
2014-12-03 23:01:30 +00:00
Martin Tschammer
ab25d706c7
Renamed validated_attrs to validated_data to be more in line with other similar code.
2014-12-03 23:52:35 +01:00
Tom Christie
e1d98f7756
Improve nested update and create testing.
2014-12-03 22:45:44 +00:00
Tom Christie
f2dd05a6e6
Improved nested update test in update().
...
Closes #2194 .
2014-12-03 22:43:40 +00:00
Tom Christie
76ac641fbd
Minor tweaks for helpful message on Model.objects.create() failure.
2014-12-02 13:04:49 +00:00
Tom Christie
54b7b32818
Merge branch 'fixes/2013' of git://github.com/gregmuellegger/django-rest-framework into gregmuellegger-fixes/2013
2014-12-02 12:46:47 +00:00
Tom Christie
79e18a2a06
Raise assertion error if calling .save() on a serializer with errors. Closes #2098 .
2014-12-02 09:27:40 +00:00
Tom Christie
270c7acdd7
Minor validtors tweak
2014-12-01 11:59:04 +00:00
Tom Christie
22c5b863bc
More descriptive docstring on ModelSerializer
2014-12-01 11:37:38 +00:00
Tom Christie
b9503cd603
Support Django's core ValidationError for backwards compat. Refs #2145 .
2014-12-01 10:48:45 +00:00
Tom Christie
d4b8e356b9
Merge branch '3.0-docs'
2014-11-28 09:57:02 +00:00
Tom Christie
34ca8cd2a5
Moar docs. Amazing.
2014-11-28 09:56:44 +00:00
Tom Christie
6b2033f789
Drop transform_<field_name>
2014-11-27 16:40:58 +00:00
Tom Christie
fd980be39b
Documentation in 'many_init' docstring. Refs #2120 .
2014-11-25 10:39:58 +00:00
Tom Christie
bde7255413
Fix non-determanistic default bug. Closes #2099 .
2014-11-20 09:30:49 +00:00
Tom Christie
40b1ea919b
Fix non-determanistic unique constraint mapping. Refs #2092 .
2014-11-19 14:51:49 +00:00
Tom Christie
8516281078
Minor fix for #2092 .
2014-11-19 14:40:30 +00:00
Tom Christie
8586290df8
Apply defaults and requiredness to unique_together fields. Closes #2092 .
2014-11-19 13:55:10 +00:00
Tom Christie
5e74f02d61
Note removal of 'save_object' and fail loudly if it exists
2014-11-18 14:49:00 +00:00
Gregor Müllegger
ad060aa360
More helpful error message when default .create
fails. Closes #2013 .
2014-11-15 15:29:52 +01:00
Tom Christie
7394dcec9e
ReturnList and ReturnDict wrapped at nicer point
2014-11-13 23:05:44 +00:00
Tom Christie
992330055e
Refactor many
2014-11-13 21:11:13 +00:00
Tom Christie
78a741be27
Split out .create and .update on ListSerializer
2014-11-13 20:24:48 +00:00
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
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
Xavier Ordoquy
51e6982397
Fixed the validation for optional fields that have a value.
2014-03-06 21:18:37 +01:00
Rodolfo Carvalho
94fe03779b
Fix typo
2014-03-05 17:01:54 +01:00
Carlton Gibson
95670933d7
Test and quick fix for #1257
2014-02-11 14:44:56 +01:00
juroe
b182b9e246
Fixes typo (Implicit instead of Implict).
2014-02-04 11:56:41 +01: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
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
Dustin Farris
b1b58762a3
Move models.resolve_model to serializers._resolve_model
2014-01-13 11:47:44 -05: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
e1bbe9d514
Set allow_none = True
for CharFields with null=True
2014-01-12 10:53:54 +02: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
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
Tom Christie
a439c80cd8
Less brittle through relationship testing. Closes #1292 .
2013-12-21 21:21:53 +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
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
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