Tom Christie
2df80c3c9d
Merge pull request #4688 from theosotr/feature-source
...
Support usage of 'source' in `extra_kwargs`.
2017-03-13 10:25:38 +00:00
Ran Benita
7a408f6cd2
Guard against the possible misspelling readonly_fields
in model serializers
...
Fixes #4897 .
2017-02-22 13:27:23 +02:00
Isaac Stone
289e1e440e
Check for collection.Mapping instead of dict
...
issue #4901
2017-02-19 13:10:03 -08:00
Artem Muterko
773b68e188
Fix typos in Python files
2017-01-08 15:36:49 +02:00
Ryan P Kilby
11fd3bf108
Add disabling of declared fields on serializer subclasses ( #4764 )
...
* Add test for disabling declared fields on child
* Check that declared base field is not in attrs
* Update meta inheritance docs to include serializer
* Test that meta fields cannot be declared as None
* Add docs example for declarative field disabling
2017-01-03 21:14:19 +00:00
Thodoris Sotiropoulos
4c2d6b9bb7
Do not ignore source when building fields dynamically
...
This commit fixes the issue when you set the keyword argument `source`
and your have not set the serializer fields explicitly. Then the
construction of field failed because there is not actually any model
field with that name.
However, you are still able to imply the name of model field by
providing the `source` keyword argument.
2016-11-17 18:51:22 +02:00
Tom Christie
8bab7f8d58
Only apply the nested writes test to writable fields. ( #4669 )
2016-11-10 16:36:56 +00:00
Ryan P Kilby
d92b24a0b7
Make serializer fields import explicit ( #4628 )
2016-11-01 10:27:11 +00:00
Tom Christie
f1bdce17b5
Fix for case of ListSerializer with single item ( #4609 )
2016-10-21 15:21:23 +01:00
Tom Christie
8d0a91b002
Fix 3674 ( #4571 )
...
Handle ModelSerializer case for relationships to models with custom pk.
2016-10-13 12:43:43 +01:00
Tom Christie
88c6c380c5
Use field.source to perform check for writable nested field, not key ( #4568 )
2016-10-12 16:51:01 +01:00
Tom Christie
b419970431
Handle empty data with serializer ( #4564 )
2016-10-12 10:47:17 +01:00
Tom Christie
a3802504a0
Error codes ( #4550 )
...
Add error codes to `APIException`
2016-10-11 10:25:21 +01:00
Tom Christie
0dec36eb41
Version 3.5 ( #4525 )
...
* Start test case
* Added 'requests' test client
* Address typos
* Graceful fallback if requests is not installed.
* Add cookie support
* Tests for auth and CSRF
* Py3 compat
* py3 compat
* py3 compat
* Add get_requests_client
* Added SchemaGenerator.should_include_link
* add settings for html cutoff on related fields
* Router doesn't work if prefix is blank, though project urls.py handles prefix
* Fix Django 1.10 to-many deprecation
* Add django.core.urlresolvers compatibility
* Update django-filter & django-guardian
* Check for empty router prefix; adjust URL accordingly
It's easiest to fix this issue after we have made the regex. To try
to fix it before would require doing something different for List vs
Detail, which means we'd have to know which type of url we're
constructing before acting accordingly.
* Fix misc django deprecations
* Use TOC extension instead of header
* Fix deprecations for py3k
* Add py3k compatibility to is_simple_callable
* Add is_simple_callable tests
* Drop python 3.2 support (EOL, Dropped by Django)
* schema_renderers= should *set* the renderers, not append to them.
* API client (#4424 )
* Fix release notes
* Add note about 'User account is disabled.' vs 'Unable to log in'
* Clean up schema generation (#4527 )
* Handle multiple methods on custom action (#4529 )
* RequestsClient, CoreAPIClient
* exclude_from_schema
* Added 'get_schema_view()' shortcut
* Added schema descriptions
* Better descriptions for schemas
* Add type annotation to schema generation
* Coerce schema 'pk' in path to actual field name
* Deprecations move into assertion errors
* Use get_schema_view in tests
* Updte CoreJSON media type
* Handle schema structure correctly when path prefixs exist. Closes #4401
* Add PendingDeprecation to Router schema generation.
* Added SCHEMA_COERCE_PATH_PK and SCHEMA_COERCE_METHOD_NAMES
* Renamed and documented 'get_schema_fields' interface.
2016-10-10 13:03:46 +01:00
orf
d540f0262b
Improve Create to show the original exception traceback ( #3508 )
2016-08-19 14:42:13 +01:00
Dmitry Dygalo
e1768bdc16
Fixed various typos ( #4366 )
2016-08-08 09:32:22 +01:00
Tom Christie
a9a097496e
extra_kwargs takes precedence over uniqueness kwargs ( #4349 )
2016-08-02 14:33:15 +01:00
Tom Christie
6a7d34ec34
Unique together checks should apply to fields that are read only, but have a default. ( #4316 )
2016-07-27 15:40:04 +01:00
Tom Christie
8385ae42c0
3.4.0 Release ( #4258 )
...
* 3.4.0 Release
* Version 3.4 release
* Full release notes
* Update translation files
* Update release documentation
* Update release notes
* Docs on supporting alternate schema formats
* Add schema_renderers to DefaultRouter
2016-07-13 16:30:41 +01:00
Vadim
c0f4dfd8f3
Add tests for the ListSerializer for the TestSerializerPartialUsage.
...
Additional fix partial update for the ListSerializer.
2016-06-29 09:48:31 +03:00
Vadim
53a1205dd0
Fix partial update for the ListSerializer.
2016-06-24 15:04:18 +03:00
Tom Christie
c3b7fba918
Exclude read_only=True fields from unique_together validation & add docs. ( #4192 )
...
* Exclude read_only=True fields from unique_together validation
* Test to ensure that unique_together validators can be removed
* Do not add uniquness_extra_kwargs when validators are explicitly declared.
* Add docs on validation in complex cases
2016-06-13 13:31:12 +01:00
Tom Christie
a5f822d067
Empty cases of .validated_data and .errors as lists not dicts for ListSerializer ( #4180 )
2016-06-08 15:55:09 +01:00
Tom Christie
9c996d7d2a
Clean up existing deprecation warnings. ( #4166 )
...
* Add Meta.fields = '__all__' to serializer classes where required.
* Add explicit on_delete=models.CASCADE to ForeignKey fields.
* Use '.remote_field' and '.model' in preference to '.rel' and '.to' when inspecting model fields.
* Use new value_from_object in preference to internal _get_val_from_obj
2016-06-02 14:39:10 +01:00
Xavier Ordoquy
0e8306341d
Merge pull request #3936 from carltongibson/null-uuid-fk-take2
...
Fix None UUID ForeignKey serialization
2016-03-22 22:46:33 +01:00
Carlton Gibson
2ef74cfa61
Bring check for null fk to BaseSerializer.to_representation
2016-03-13 20:39:19 +01:00
Karambir Singh Nain
69f1e3a9fd
Remove old django checks from tests and compat
...
Remove skipping of tests for Django<1.8. Remove several functions from compat.py not needed for Django>=1.8
2016-02-19 01:47:45 +05:30
Federico Bond
03b5438d07
Add missing space in serializer error message
2016-02-11 15:09:21 -03:00
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
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