Commit Graph

541 Commits

Author SHA1 Message Date
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
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