Commit Graph

521 Commits

Author SHA1 Message Date
Tom Christie
f01a3d9c36 Merge pull request #3801 from koordinates/fix-nested-validation-error
Fix nested validation error being rendered incorrectly.
2016-01-07 09:22:23 +00:00
Kevin Massey
7cd3933144 Fixes #3804, avoiding update of Meta.extra_kwargs
Added unit test to cover.
2016-01-06 15:04:51 -05:00
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