Tom Christie
95abe6e844
Cleanup docstrings
2013-04-25 12:47:34 +01:00
Tom Christie
4bf1a09bae
Ensure implementation of reverse relations in 'fields' is backwards compatible
2013-04-23 11:31:38 +01:00
Mark Aaron Shirley
7e0a93f0ee
Don't use field when saving related data
2013-04-19 10:46:57 -07:00
Mark Aaron Shirley
fdc5cc3d81
Fix model serializer nestesd delete behavior
2013-04-18 10:28:20 -07:00
Mark Aaron Shirley
c7e000e46e
Merge remote-tracking branch 'upstream/master' into writable-nested-modelserializer
...
Conflicts:
docs/api-guide/serializers.md
2013-04-16 09:55:47 -07:00
Stephan Groß
c329d2f085
Add DecimalField to field_mapping
2013-04-15 13:11:41 +02:00
Tom Christie
76e039d70e
First pass on automatically including reverse relationship
2013-04-10 22:38:02 +01:00
Mark Aaron Shirley
73efa96de9
one-many writable nested modelserializer support
2013-04-06 08:43:21 -07:00
J. Paul Reed
889558365b
Don't have the ModelSerializer trust deserialized objects to not have redefine bool()ean-ness.
...
If the model we're using the ModelSerializer for has redefined methods that act as a boolean (__bool__ or __len__), it may not return the object even though it is_valid(), and should.
2013-04-02 01:41:40 -07:00
Tom Christie
7eefcf7e53
Bulk update, allow_add_remove flag
2013-03-25 20:26:34 +00:00
Tom Christie
d97e72cdb2
Cleanup one-one nested tests and implementation
2013-03-25 17:28:23 +00:00
Tom Christie
3f79a9a3d3
one-one writable nested modelserializers
2013-03-22 22:39:45 +00:00
Tom Christie
addf7e9b36
Defer the writable nested modelserializers work
2013-03-22 22:27:03 +00:00
Tom Christie
9bf7c9b714
Merge master
2013-03-22 21:57:37 +00:00
Tom Christie
13794baf70
Bit of extra tidying and plenty of docs
2013-03-22 17:01:06 +00:00
Tom Christie
c32d9969ac
Add extra tests for errors from incorrect data with multiple create/update
2013-03-22 12:33:09 +00:00
Tom Christie
b2dc664485
Basic bulk create and bulk update
2013-03-19 14:26:48 +00:00
Craig de Stigter
101fa26ebc
use writablefield style for serializer handling of self.default
2013-03-18 16:05:34 +13:00
Craig de Stigter
d6d5b1d82a
allow default values in writable serializer fields
2013-03-18 14:50:21 +13:00
Craig de Stigter
c8416df0c4
accept all WritableField kwargs for writable serializers (eg required=True)
2013-03-18 14:27:15 +13:00
Tom Christie
66bdd608e1
Fixes to save_object
2013-03-16 07:35:44 +00:00
Tom Christie
3ff103ad04
Fixes to save_object
2013-03-16 07:35:27 +00:00
Tom Christie
ccf551201f
Clean up and comment restore_object
2013-03-16 07:32:50 +00:00
Tom Christie
56653111a6
Remove unneeded arguments to save_object
2013-03-15 19:57:57 +00:00
Tom Christie
32e0e5e18c
Remove erronous _delete attribute
2013-03-15 19:55:32 +00:00
Tom Christie
47492e3ef4
Clean out ModelSerializer special casing from Serializer.field_from_native
2013-03-15 19:22:31 +00:00
Tom Christie
fb3b57803f
one 2 one nested relationships
2013-03-15 19:17:54 +00:00
Mark Aaron Shirley
3006e3825f
One-to-one writable, nested serializer support
2013-03-14 15:17:13 -07:00
Tom Christie
acc8c1faa4
force_insert, force_update arguments. Closes #484 .
...
Confirmed by `assertNumQueries(…)` in tests.
2013-03-13 20:40:39 +00:00
Tom Christie
2f1951910f
Descriptive text for NestedValidationError
2013-03-12 18:35:20 +00:00
Tom Christie
6b4bb48dd4
Initial support for writable nested serialization (Not ModelSerializer)
2013-03-12 13:33:02 +00:00
Mjumbe Wawatu Ukweli
bdcecf48e3
Simplify inherited child check to not use isinstance
2013-03-11 16:01:19 -04:00
Mjumbe Wawatu Ukweli
e7e470739f
Use parent's primary key when model is derived via multitable inheritance
2013-03-11 03:23:44 -04:00
Tom Christie
239758e034
Serializers support bulk create.
2013-03-09 10:21:53 +00:00
Tom Christie
28ae26466e
Py3k fixes.
2013-03-08 22:43:46 +00:00
Tom Christie
68683b2ea2
Tweak implementation, and use FormSet style errors
2013-03-08 22:19:09 +00:00
Ian Dash
66605acaf0
Errors during deserializing lists now return a list of tuples with
...
index of bad item in data plus usual errors dict
2013-03-08 15:08:05 +00:00
Tom Christie
183d3ec6a4
Move ModelSerializer field_mapping into an attribute for easier overriding.
2013-02-28 13:41:42 +00:00
Danilo Bargen
e476dcb8c7
Changed AttributeError to AssertionError
2013-02-26 09:38:57 +01:00
Danilo Bargen
ec4d79bcaf
Show class name in exception message
2013-02-25 23:02:42 +01:00
Danilo Bargen
3e6f99e273
Improved exception message for missing serializer model meta option
2013-02-25 22:34:05 +01:00
Tom Christie
e1f0001f92
Fix and test for #645
...
Yuck, pickle is weird. Closes #645 .
2013-02-22 23:00:07 +00:00
Tom Christie
bba918fb2a
Fix and test case for #653
...
Closes #653
2013-02-22 22:13:06 +00:00
Tom Christie
bc87bf13b4
Tests and fix for #666 .
...
Closes #666 .
2013-02-22 22:02:42 +00:00
Andreas Pelme
5a5df18d18
Added a serializer TimeField
2013-02-14 21:19:51 +01:00
Tom Christie
24ed0fa4b9
Drop accidental (uneeded) validation logic.
2013-02-14 12:26:02 +00:00
Tom Christie
7f797abc19
Remove deprecated APIs from tests
2013-02-12 20:07:35 +00:00
Tom Christie
388e617366
Raise warnings on implicit many serialization
2013-02-12 13:53:45 +00:00
Tom Christie
aa03425c09
Merge pull request #651 from fernandogrd/master
...
DictWithMetadata.__getstate__ was never called (Fix for 645)
2013-02-11 23:27:35 -08:00
Fernando Rocha
ea004b5e7a
Make use o issubclass instead of isinstance (fix issue #645 )
...
Because __mro__ is a list of classes and not instances.
DictWithMetadata.__getstate__ was never called
Signed-off-by: Fernando Rocha <fernandogrd@gmail.com>
2013-02-11 19:18:22 -03:00
Tom Christie
670ac25b25
Allow serializers to handle dicts as well as objects. Fixes #447 .
2013-02-07 12:57:40 +00:00
Tom Christie
8113d66126
Use new style of required=<bool>
not blank
or null
2013-02-07 09:24:34 +00:00
Tom Christie
5813a09512
Use new many=True relations style.
2013-02-07 09:14:58 +00:00
Tom Christie
efb798cebc
Don't deprecate 'exclude'
...
Need to track outcome of Django's #19733 , and decide on approach
accordingly.
2013-02-06 08:48:41 +00:00
Tom Christie
7dc4bce4e2
Fix 2.6 compat
2013-02-04 21:35:47 +00:00
Tom Christie
b052c92ac3
Cleanup imports
...
Mostly adding `from __future__ import unicode_literals` everywhere.
2013-02-04 20:55:35 +00:00
Tom Christie
8e846bdf52
Merge branch 'py3k' into 2.2
...
Conflicts:
rest_framework/relations.py
rest_framework/serializers.py
rest_framework/tests/relations_hyperlink.py
rest_framework/tests/relations_slug.py
2013-02-04 20:37:09 +00:00
Tom Christie
f4f237e3ee
3.2, 3.3 compat
2013-02-01 14:03:28 +00:00
Tom Christie
d9c7b1c585
Merge branch 'p3k' of https://github.com/linovia/django-rest-framework into working
...
Conflicts:
rest_framework/authentication.py
rest_framework/relations.py
rest_framework/serializers.py
rest_framework/settings.py
rest_framework/tests/authentication.py
rest_framework/tests/genericrelations.py
rest_framework/tests/generics.py
rest_framework/tests/relations_hyperlink.py
rest_framework/tests/relations_nested.py
rest_framework/tests/relations_pk.py
rest_framework/tests/serializer.py
2013-02-01 11:58:55 +00:00
Tom Christie
d9b73e15c8
Serializers take many=<bool>
argument.
2013-01-31 17:06:23 +00:00
Tom Christie
f1e665673f
Tidying
2013-01-30 20:38:11 +00:00
Tom Christie
be6df3ae3c
Merge branch 'master' into many-fields
...
Conflicts:
rest_framework/relations.py
2013-01-30 13:41:56 +00:00
Andrea de Marco
85e6360792
Update rest_framework/serializers.py
2013-01-28 22:08:40 +01:00
Tom Christie
a3a06d11cc
Ensure model field validation is performed for ModelSerializers with a custom restore_object method. Fixes #623 .
2013-01-28 12:56:42 +00:00
Tom Christie
a51bca32fd
Fix issues with custom pagination serializers
2013-01-26 20:54:41 +00:00
Tom Christie
b41f258ee5
Serializers should accept source='*' argument. Fixes #604 .
...
(Test also incoming)
2013-01-26 20:54:03 +00:00
Stephan Groß
69e62457ef
Improve validate_<fieldname> fix
2013-01-23 07:53:54 +01:00
Stephan Groß
2250ab6418
Add possible solution for field validation error
2013-01-21 12:50:39 +01:00
Tom Christie
6385ac519d
Revert accidental merge.
2013-01-18 19:47:57 +00:00
Mark Aaron Shirley
221f7326c7
Use None to delete nested object as opposed to _delete flag
2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
34e14b01e4
Move nested serializer logic into .field_from_native()
2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
2d62bcd5aa
Add one-to-one nested update and delete functionality
2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
72c04d570d
Add nested create for 1to1 reverse relationships
2013-01-16 16:04:19 -08:00
Tom Christie
d9acec3e6d
PK fields should only be read-only if they are an AutoField. Fixes #563
2013-01-12 09:43:14 +00:00
Tom Christie
73c4e5c460
auto_now and auto_now_add fields should be read only by default
2013-01-12 09:43:14 +00:00
Mark Aaron Shirley
81691ff900
Merge remote-tracking branch 'upstream/master' into null-one-to-one
2013-01-08 08:33:01 -08:00
Tom Christie
4bb504732d
Respect blank=True on relational fields. Fixes #537
2013-01-07 21:08:55 +00:00
Mark Aaron Shirley
213981cef3
Handle ObjectDoesNotExist exceptions when serializing null reverse one-to-one
2013-01-04 21:11:03 +01:00
Tom Christie
26f9acb45a
Validation errors instead of exceptions when serializers receive incorrect types. Fixes #402 .
2013-01-04 14:11:05 +00:00
Tom Christie
92ae08207a
Drop unused private save_m2m flag
2013-01-03 21:49:01 +00:00
Xavier Ordoquy
60250f22c8
Move the various compat things to the compat module.
2013-01-03 11:41:07 +01:00
Xavier Ordoquy
c95fa81cb2
Use new exception style
2013-01-02 19:06:28 +01:00
Xavier Ordoquy
737349d238
Merge remote-tracking branch 'reference/py3k' into p3k
2013-01-02 16:09:21 +01:00
Mark Aaron Shirley
a617a3758f
Don't persist relation changes in ModelSerializer#restore_object()
2012-12-31 14:33:24 +01:00
Tom Christie
8fad0a727a
Relation fields move into relations.py
2012-12-31 08:53:40 +00:00
Tom Christie
caaf1c80f5
Support reverse FK creation
2012-12-29 16:51:41 +00:00
Tom Christie
809f5de330
Merge pull request #515 from yprez/blank_fields_issue
...
Fix for #514
2012-12-29 05:25:43 -08:00
Tom Christie
923f81d269
Nested serializers now support nullable relationships, plus test. Fixes #384
2012-12-29 13:19:05 +00:00
Michal Dvorak (cen38289)
5ba2437f2d
Merge remote-tracking branch 'tom/master'
...
Conflicts:
rest_framework/tests/serializer.py
2012-12-21 10:53:23 +01:00
Tom Christie
6693d2d277
Fix for pks returning as strings when set in pre_save. Fixes #482 . Thanks to @n8agrin for the bug report.
2012-12-18 18:21:58 +00:00
Tom Christie
aa72f8d63d
Fix bug with M2M in browseable API
2012-12-17 21:59:51 +00:00
Michal Dvorak (cen38289)
8ac77eaae8
Merge remote-tracking branch 'tom/master'
...
Conflicts:
rest_framework/serializers.py
rest_framework/tests/serializer.py
2012-12-17 17:01:00 +01:00
Yuri Prezument
c68f7ca580
blank=True fields are not required - fixes #514
2012-12-17 16:57:11 +02:00
toran billups
008dafce17
ManyPrimaryKeyRelatedField now supports create for one-to-many rel
2012-12-15 20:55:36 -06:00
Tom Christie
35f72cecb1
Fix model validation exclusions. Fixes #500 . Fixes #506 .
2012-12-15 20:40:41 +00:00
Tom Christie
39b01d6802
Ensure context is passed to dynamically added fields. Fixes #476 .
2012-12-14 19:59:29 +00:00
Tom Christie
497da7fc69
Clean up field initialization. Fixes #497
2012-12-12 20:45:06 +00:00
Tom Christie
85bf4164dd
Drop left over code
2012-12-11 22:09:04 +00:00
Tom Christie
4058223309
Fix broken nested fields
2012-12-11 21:07:25 +00:00
Marko Tibold
d0935d1fbb
get_excluded_fieldnames() should respect Meta options' ability to be either a tuple or list. Fixes #490 .
...
Refactored `if self.opt.fields` out of the for loop.
Updated and cleaned up the validation-tests.
2012-12-10 23:10:04 +01:00
Tom Christie
ac2720afcb
Add null related field option
2012-12-08 13:00:49 +00:00
Tom Christie
303bc7cf95
Support nullable FKs, with blank=True
2012-12-07 21:32:45 +00:00
Tom Christie
a5178e9a36
Merge pull request #451 from markotibold/#431
...
Call model's .full_clean() method, eg. to validate uniqueness
2012-12-07 12:34:56 -08:00
Marko Tibold
919aff329e
Fix AttributeError caused by accessing a non-existing default_keys attribute.
2012-12-07 00:08:27 +01:00
Tom Christie
6ffcd7ba36
Merge pull request #477 from roberts81/master
...
Fix for #460
2012-12-06 14:54:28 -08:00
Marko Tibold
c65f22e0e4
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework into #431
2012-12-06 23:47:47 +01:00
Ben Roberts
cb7d9ea5c9
cleaned up white space & docstring styling
2012-12-06 12:45:50 -07:00
Ben Roberts
705c7ad09d
added tests and fix for unpickleable metadata in SortedDictWithMetadata
2012-12-05 17:43:47 -07:00
Michal Dvorak (cen38289)
2a82b64963
Moved smart_unicode to Field ctor, to mimic Django Forms behavior.
2012-12-04 14:22:41 +01:00
Michal Dvorak
ad01fa0eae
#467 Added unit test
2012-12-03 19:07:07 +01:00
Michal Dvorak (cen38289)
9ae0ca1cae
#467 Added label and help_text to Field
2012-12-03 17:26:01 +01:00
Xavier Ordoquy
5fad46d7e2
Merge remote-tracking branch 'reference/master' into p3k
2012-12-02 12:43:32 +01:00
Pavel Savchenko
e311b763e1
add traverse_related feature + tests (fixes issue#461)
2012-11-30 01:34:46 +02:00
Marko Tibold
899f96ae91
Added a get_excluded_fieldnames() method.
...
Model validation now excludes fields not listed in Meta fields (if set).
2012-11-27 23:49:27 +01:00
Marko Tibold
f104f74340
Moved model validation from .perform_validation() to .validate()
2012-11-27 23:21:12 +01:00
Tom Christie
7ade5add21
Merge pull request #439 from irrelative/master
...
Cache all fields per serializer instance
2012-11-22 16:17:47 -08:00
Marko Tibold
bd8c742df2
Cleanup.
2012-11-22 23:39:16 +01:00
Marko Tibold
ca5b99486d
Added _post_clean() behaviour by adding a .perform_model_validation() method.
...
Fixed some tests that were failing due to extra strict validation.
2012-11-22 22:36:37 +01:00
jedavis83@gmail.com
2e36e0c910
Remove unneeded and incorrect self reference
2012-11-22 12:22:30 -08:00
jedavis83@gmail.com
08e7818530
More consistent iteration over default_fields, per feedback.
2012-11-22 11:27:55 -08:00
jedavis83@gmail.com
e9944f82d1
Keep Serializer.fields API consistent while caching values.
2012-11-22 10:50:29 -08:00
Xavier Ordoquy
4007b56457
28 tests passes now.
2012-11-22 08:30:32 +01:00
Mark Aaron Shirley
0876bed963
Merge remote-tracking branch 'upstream/master' into partial-update
2012-11-21 09:37:22 -08:00
Stephan Groß
774d687a31
updated comparison due to pep8 programming recommendations
...
http://www.python.org/dev/peps/pep-0008/#programming-recommendations
2012-11-21 14:58:33 +01:00
jedavis83@gmail.com
8b0561c57e
Cache all fields on serializer init, not just default fields.
2012-11-20 23:09:47 -08:00
Tom Christie
9b63ba3800
Merge pull request #433 from irrelative/master
...
Cache default_fields per serializer instance for faster serialization
2012-11-20 15:13:30 -08:00
Mark Aaron Shirley
c3644234cd
Add support for partial serializer updates
2012-11-20 11:01:21 -08:00
Jamie Matthews
68c397371c
Fix related serializers with source argument that resolves to a callable
2012-11-20 09:41:36 +00:00
jedavis83@gmail.com
2cf0fda2ae
Cache default fields per serializer instance for improved performance
2012-11-19 22:09:40 -08:00
Tom Christie
e801e21210
Merge pull request #422 from markotibold/max_length_for_modelserializers
...
Max length for modelserializers
2012-11-16 14:54:16 -08:00
Marko Tibold
1a436dd6d9
Added URLField and SlugField.
...
Fixed test_modelserializer_max_length_exceeded
2012-11-16 22:43:16 +01:00
Marko Tibold
f385b72d80
Whoops … Drop pdb
2012-11-16 22:20:26 +01:00
Marko Tibold
aa013a4289
Fixes #421
2012-11-16 22:18:57 +01:00
Marko Tibold
403886b79b
Merge commit '3b258d69c92e9d9293f7c5d1690f0ca434e677e3' into file_and_image_fields
2012-11-15 22:48:22 +01:00
Marko Tibold
c35b9eb065
Processed review comments.
...
No type checking in .restore_fields()
Added missing BytesIO import.
2012-11-14 21:13:23 +01:00
Stephan Groß
44ff2e0add
fixed some typos
2012-11-14 19:36:29 +01:00
Marko Tibold
5443dd5f3c
Added a FileField and an ImageField (copied from django.forms.fields).
...
Adjusted generics, mixins and serializers to take a `files` arg where applicable.
2012-11-13 23:26:17 +01:00
Tom Christie
21468a1867
Fix broken depth argument
2012-11-13 11:47:32 +00:00
Tom Christie
e224061189
Support for read_only_fields
on ModelSerializer
classes
2012-11-09 17:01:20 +00:00
Tomi Pajunen
40c6fe7119
Comments updated
2012-11-08 17:04:29 +02:00
Tomi Pajunen
743224d000
Fixed creation of objects with reversed M2M relations
2012-11-08 16:31:16 +02:00
Toni
5d69628250
Update rest_framework/serializers.py
...
fixed AttributeError in case restore_object is overwritten without explicitly setting self.m2m_data
2012-11-05 20:55:03 +01:00
Tom Christie
6d201c362f
Drop unneccesarily lenient dictionary-containing-instances serialization.
2012-11-05 16:19:11 +00:00
Tom Christie
33be4b43b9
queryset
argument is now optional on writable model fields.
2012-11-05 12:51:04 +00:00
Tom Christie
ccd5f29510
Tidy up serializer fields now we no longer use dynamic fields
2012-11-05 11:03:36 +00:00
Tom Christie
dfb8225447
Add note on * import
2012-11-05 10:56:30 +00:00
Tom Christie
b7b942c599
Swap position of instance
and data
keyword arguments.
2012-11-05 10:53:20 +00:00
Tom Christie
0047a46020
Merge fixes for 'blank=True' fields. Fixes #324 , Fixes #325
...
Thanks to @Roarster.
2012-10-30 11:03:03 +00:00
Tom Christie
e5777a6168
Merge pull request #336 from markotibold/null_is_true_model_fields
...
Null is true model fields
2012-10-30 02:22:51 -07:00
Marko Tibold
4d90bb4af4
Fix some typos.
2012-10-30 00:30:52 +01:00