Craig de Stigter
651319e2da
Fix nested validation error being rendered incorrectly.
...
Previously an extra list wrapped nested validation errors raised from serializer's validate() methods.
That was inconsistent with the format of validation errors raised by validate_<fieldname> methods.
i.e. these two resulted in *different* behaviour:
def validate_foo(self):
raise ValidationError(['bar'])
def validate(self):
raise ValidationError({'foo': ['bar']})
2016-01-06 16:05:43 +13:00
Tom Christie
54b79db214
Proper 'is primary key' checking
2015-11-04 14:37:32 +00:00
likeon
322bda8159
Added support for the to_field on ForeignKey fields
2015-10-21 15:33:18 +03:00
Omer Katz
2e178bc970
Replaced all dict and set conversions from lists to dict and set literals.
2015-10-17 12:00:11 +03:00
Tom Christie
10dbf1316f
Added JSONField. Closes #3170 .
2015-09-28 17:25:52 +01:00
Tom Christie
ca8313aeac
Merge branch 'master' into version-3.3
...
Conflicts:
docs/topics/release-notes.md
2015-09-28 10:57:14 +01:00
Tom Christie
6284bceaaf
Merge pull request #3363 from tomchristie/dont-access-settings-on-import
...
Access settings lazily, not at module import.
2015-09-24 15:42:31 +01:00
paolopaolopaolo
7640bfea9e
Add assert
statement to .save()
method in Serializer:
...
- Asserts that `_data` does not exist when calling `.save()`
2015-09-22 11:49:51 -07:00
Tom Christie
a3067bea55
Merge branch 'master' into version-3.3
2015-09-17 16:24:46 +01:00
Xavier Ordoquy
4404d40f60
Only pass allow_empty to the ListSerializer
if it was in the arguments.
...
Helps with backward compatibility.
2015-09-06 23:02:44 +02:00
Xavier Ordoquy
dcdd765647
Avoid passing allow_empty to the ListSerializer children.
2015-09-03 17:27:33 +02:00
Tom Christie
10da18b20b
Access settings lazily, not at module import
2015-09-03 16:24:13 +01:00
José Padilla
654e0e4527
Update ModelSerializer fields behavior
2015-08-27 13:09:08 -04:00
Tom Christie
8d7c0a8474
Merge branch 'feature/filepathfield' of https://github.com/Ins1ne/django-rest-framework into Ins1ne-feature/filepathfield
2015-08-03 10:09:46 +01:00
Tom Christie
a543fae180
Merge pull request #2766 from delinhabit/allow-null-list-serializer
...
Modify subtle ChildSerializer(many=True, allow_null=True) behavior.
2015-07-31 10:11:21 +01:00
Tom Christie
1b3b01e042
Remove unused imports
2015-07-30 15:59:27 +01:00
Tom Christie
c203ca4c64
Deprecations
2015-07-30 15:26:42 +01:00
Tom Christie
402fb39396
HStoreField maps to ListField(CharField(allow_blank=True). Closes #2659 .
2015-07-27 13:18:49 +01:00
Ion Scerbatiuc
bf25a6ecbc
Test case for using allow_null
with many=True
and a fix for it
2015-07-25 08:10:15 -07:00
Tom Christie
90fe0fb881
Errors in browsable API on error. Closes #3024 .
2015-07-23 14:31:25 +01:00
Aider Ibragimov
a1397ac699
fix bugs, move version branching to compat, update ModelSerializer mapping
2015-07-19 00:26:03 +03:00
Tom Christie
138e9fcc8f
Helpful error on erronous 'serializer.save(commit=False)'
2015-07-17 12:39:22 +01:00
Tom Christie
e14391e041
Fix for ModelSerializer ChoiceField with nonstandard args. Closes #3126 .
2015-07-16 15:46:27 +01:00
Tom Christie
264d423493
Added allow_empty flag for ListField, ListSerializer, ManyRelation, MultipleChoiceField.
2015-07-16 13:51:15 +01:00
Tom Christie
3c57e08f62
Clarifications to read_only fields. Closes #3064 .
2015-07-14 12:22:51 +01:00
Tom Christie
209bcb9087
Added url_field_name class attribute to ModelSerializer. Closes #3106 .
2015-07-14 11:21:33 +01:00
Juan Gutierrez
b0c5f9db2f
allow a non-required nested serializer to validate correctly when receiving multipart data
2015-07-03 12:28:48 -04:00
Tyler Redzko
af08c70242
Update extra_kwargs on model serializer
...
Ensures that the 'read_only' and 'required' keys from `extra_kwargs` are
retained when present. Closes #3091 .
2015-07-01 10:10:18 -04:00
José Padilla
7351a3f6ca
Sort imports with isort
2015-06-25 16:55:51 -04:00
José Padilla
83c9136c90
Cleanup import following PEP 8 style guide
2015-06-25 16:10:17 -04:00
José Padilla
d6e30c75ff
Add test and fix for #2704
2015-06-25 09:35:36 -04:00
Tom Christie
1e678791de
Merge pull request #2922 from thedrow/patch-11
...
Cache fields list for to_internal_value and to_representation
2015-06-23 08:53:32 +01:00
Omer Katz
1701ddae35
Fixed formatting of _readable_fields list comprehension to match the formatting of the _writable_fields list comprehension.
2015-06-20 08:51:03 +03:00
Xavier Ordoquy
dee5fb5647
Merge remote-tracking branch 'reference/master' into feature/ipaddress-fix
...
Conflicts:
docs/api-guide/fields.md
2015-06-04 14:21:33 +01:00
Xavier Ordoquy
14055dd3f4
Merge pull request #2989 from ticosax/duration-field
...
Add DurationField
2015-06-01 17:38:57 +01:00
Nicolas Delaby
f701ecceb7
Add DurationField
2015-06-01 18:20:53 +02:00
Xavier Ordoquy
e3f856ff1d
Merge pull request #2975 from sheppard/read-only-nested
...
can't create nested serializers for unique_together relations
2015-06-01 12:01:40 +01:00
Corentin Smith
fa29f7dd1f
Fix minor typo
2015-05-30 17:57:35 +02:00
S. Andrew Sheppard
8c7b5fc5c1
pop required extra_kwargs if read_only is set
2015-05-27 21:14:13 -05:00
Omer Katz
67ff078388
Renamed the cached fields lists.
2015-05-17 09:54:33 +03:00
Omer Katz
1ee3173583
Cache fields list for to_internal_value and to_representation.
2015-05-09 14:37:49 +03:00
Tom Christie
2eb9107b87
Merge pull request #2798 from Boomerangz/depth-should-reduce
...
Depth should reduce on nested ModelSerializer classes.
2015-04-27 16:22:22 +01:00
Igor Zygin
2d5b4f4cc9
Depth should reduce
...
Depth should reduce
2015-04-06 10:13:25 +06:00
Ilias Kiourktsidis
486f0a9367
Raise error when ModelSerializer used with abstract model
2015-03-23 15:01:19 +00:00
Aider Ibragimov
de72022f80
Merge branch 'master' of https://github.com/Ins1ne/django-rest-framework into feature/ipaddress
2015-02-28 14:29:27 +03:00
Aider Ibragimov
313b3d7c3b
Update ModelSerializer mappings
2015-02-28 10:18:47 +03:00
Danilo Bargen
86c5fa2401
Force-evaluate querysets (see #2602 )
2015-02-25 18:54:47 +01:00
Tom Christie
dbd2352165
Fixes for latest pep8 updates. Refs #2563 .
2015-02-17 10:58:00 +00:00
Tom Christie
fbb21caaaa
Merge master
2015-02-09 20:43:50 +00:00
Tom Christie
0240df1a38
Minor internal API cleanpu
2015-02-06 16:15:10 +00:00
Tom Christie
670723f021
Minor cleanups/improvements to ModelSerializer API
2015-02-06 15:45:02 +00:00
Tom Christie
1f99612845
Upgrade pending deprecations to deprecations
2015-02-06 13:21:35 +00:00
José Padilla
c696b0ba0c
Fix possible nested array fields
2015-02-05 10:12:14 -04:00
José Padilla
48fa77c09e
Add child to ListField when using ArrayField
2015-02-04 23:33:59 -04:00
Jason Yan
4b65e9e42b
Fixed missing whitespace in error string.
2015-02-02 16:14:34 -08:00
Omer Katz
8f1d42e7d5
Fixed typos in docstrings.
2015-02-02 10:50:54 +02:00
José Padilla
37dce89354
Add support for Django 1.8’s ArrayField
2015-02-01 15:33:34 -04:00
José Padilla
760b25bc20
Fix AttributeError on renamed _field_mapping
2015-01-30 11:36:03 -04:00
Tom Christie
4ee4b4f2dc
Merge master
2015-01-30 14:00:25 +00:00
Tom Christie
35f6a82462
Added DictField and support for HStoreField.
2015-01-23 16:27:23 +00:00
Tom Christie
e8db1834d3
Added UUIDField.
2015-01-23 15:24:06 +00:00
Tom Christie
8f25c0c53c
Add 1.8 support
2015-01-23 14:56:15 +00:00
Xavier Ordoquy
15f797fd3e
Owned by import *
2015-01-21 19:46:31 +01:00
Xavier Ordoquy
857185cf07
Workaround Django issue 24198.
2015-01-21 19:29:40 +01:00
Tom Christie
9ec08ce578
Merge master
2015-01-21 13:12:14 +00:00
Tom Christie
da6ef3d0b0
Allow missing fields option for inherited serializers. Closes #2388 .
2015-01-21 13:03:37 +00:00
Tom Christie
11efde8905
Merge pull request #2373 from jakul/document-translations-3.1
...
Document how to translate DRF error messages (version 3.1)
2015-01-09 11:57:02 +00:00
Craig Blaszczyk
58ec7669ae
swap backticks for double quotes
2015-01-07 18:22:30 +00: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
Craig Blaszczyk
4c32083b8b
use double quotes for user visible strings; end user visible strings in full stops; add some missing translation tags
2015-01-07 12:01:11 +00:00
Tom Christie
949e3b7507
Merge branch 'master' into version-3.1
2015-01-05 15:04:23 +00:00
Tom Christie
6fd33ddea9
Udpate docstring
2015-01-05 15:04:01 +00:00
Tom Christie
49dc037a96
Update docstring
2015-01-05 15:03:09 +00:00
Tom Christie
b6ca7248eb
required=False allows omission of value for output. Closes #2342
2015-01-05 14:32:12 +00:00
Tom Christie
2a1485e009
Final bits of docs for ModelSerializer fields API
2014-12-19 21:32:43 +00:00
Tom Christie
62f78dfbf1
Copy validators lists on instantiation.
2014-12-19 15:50:29 +00:00
Tom Christie
75e81b8254
build_*_field methods
2014-12-19 15:35:52 +00:00
Tom Christie
f72928ea98
build_field, build_final_kwargs
2014-12-19 15:09:57 +00:00
Tom Christie
94883ae7cd
Merge branch 'version-3.1' into model-serializer-api
2014-12-19 14:53:21 +00:00
Tom Christie
80bacc5fb0
depth should reduce by one on each nesting level. Closes #2287 .
2014-12-19 14:52:53 +00:00
Tom Christie
4a112fc3a6
Clean up
2014-12-19 14:51:45 +00:00
Tom Christie
caa1318124
get_uniqueness_field_options first pass
2014-12-19 13:13:20 +00:00
Tom Christie
1a84943a00
get_extra_kwargs
2014-12-19 12:27:50 +00:00
Tom Christie
6d907cde9a
get_field_names, get_default_field_names
2014-12-19 12:18:40 +00:00
Tom Christie
ba753a7536
Merge branch 'version-3.1' into model-serializer-api
2014-12-19 11:53:26 +00:00
Tom Christie
5830f7e138
get_unique_together_validators and get_unique_for_date_validators
2014-12-19 10:15:36 +00:00
Tymur Maryokhin
d60ecfc498
Assert fields in exclude
are model fields
2014-12-18 16:03:15 +01:00
Tom Christie
c6137bbf5a
Serializer API restrictions.
2014-12-17 14:14:51 +00:00
Tom Christie
72e08a3e8b
Use unicode internally everywhere for 'repr'
2014-12-15 11:55:17 +00:00
Tom Christie
c0b9115bec
Improve check for nested writes
2014-12-13 14:17:24 +00:00
J. Iván Alegre
428630c197
Fix trailing space
2014-12-10 10:13:15 +01:00
J. Iván Alegre
9161e5a927
Remove unnecessary hasattr all and add comment for nested relationships
2014-12-10 09:19:27 +01:00
J. Iván Alegre
59470667db
Take in care that input data in serializer can be a Manager
2014-12-09 17:49:07 +01:00
Julio Iván Alegre
8d6b0b1f2d
Update serializers.py
...
Treat the input queryset as it comes (maybe it has been changed in a higher level). Evaluating .all() does nothing if or if not is a queryset.
2014-12-09 16:13:18 +01:00
José Padilla
afe7ed9333
Add allow_blank for ChoiceField #2184
...
This makes a ChoiceField optional in HTML if
model field has `blank=True` set.
2014-12-09 09:25:06 -04:00
Tom Christie
eee02a47d9
Added ListSerializer.validate(). Closes #2168 .
2014-12-08 14:56:45 +00:00
Xavier Ordoquy
a257b04928
Fix missing validated_data in raise_errors_on_nested_writes
( #2221 )
2014-12-07 12:12:40 +01:00
Tom Christie
544967f36e
Test tweaks
2014-12-05 14:15:58 +00:00
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