Commit Graph

260 Commits

Author SHA1 Message Date
Chuck Harmston
cf6c11bd4b Raise appropriate error in serializer when making a partial update to set a required RelatedField to null (issue #1158) 2013-12-06 14:00:23 -06:00
Doğan Çeçen
fd2c291c4d Typo on api-guide/fields.md and serializers.py 2013-11-11 11:54:30 +02:00
Tom Christie
470134ae9b Merge pull request #1217 from benpbenp/master
Fix object creation with reverse M2M when related_name unspecified
2013-11-08 07:15:40 -08:00
Ben Pietravalle
b7b57adee2 Fix object creation with reverse M2M when related_name unspecified
It seems that field.related_query_name() does not return the related_name
for reverse M2M relations when related_name is not explicitly set in the M2M field
definition.

So, change to use obj.get_accessor_name(), where obj is an instance of
RelatedObject, as are returned by a model's
_meta.get_all_related_many_to_many_objects(), or as in the tuples returned by
_meta.get_all_m2m_objects_with_model().
2013-11-08 13:19:40 +00:00
Xavier Ordoquy
d4a50429b0 Fixed a regression with ValidationError under Django 1.6 2013-11-08 13:12:40 +01:00
Mathieu Pillard
5325890821 Improve handling of 'empty' values for ChoiceField
The empty value defaults back to '' (for backwards-compatibility) but
is changed automatically to None for ModelSerializers if the `null`
property is set on the db field.
2013-11-05 17:21:18 +01:00
Tom Christie
2394f05e5a Merge pull request #1170 from craigds/write-into-foreignkey-with-source
fix writing into foreign key with non-null source
2013-10-17 07:59:29 -07:00
Tom Christie
6a40202a64 Merge pull request #1112 from tamakisquare/issue-1111
Test case and fix for issue 1111
2013-10-17 07:31:15 -07:00
Bruno Renié
cc3c16eaa0 Fix a docstring to reflect what the method does 2013-10-17 16:08:17 +02:00
Colin Huang
c6be12f02b [Fix]: Error with partial=True and validate_<name>
The error occurs when serializer is set with partial=True and a
field-level validation is defined on a field, for which there's no
corresponding update value in .data
2013-10-15 17:05:10 -07:00
Craig de Stigter
7c3769f04b fix writing into foreign key with non-null source 2013-10-11 15:31:55 +13:00
Tom Christie
f18158358d Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2013-10-10 17:34:15 +01:00
Tom Christie
9e29c63895 Ensure read-only fields don't break with current HTML renderer behavior 2013-10-10 17:33:22 +01:00
Carlton Gibson
0bbc775b95 Merge pull request #1071 from craigds/field-transform-methods
Feature: add transform_<fieldname> methods to serializers
2013-10-09 01:11:46 -07:00
Tom Christie
8d4ba478cc Fix rendering of forms and add error rendering on HTML form 2013-10-02 16:13:34 +01:00
Tom Christie
a14f1e8864 Serializers can now be rendered directly to HTML 2013-10-02 13:45:35 +01:00
Carlton Gibson
f07a4f4ca3 Clear cached serializer data on save() + test. Fixes #1116. 2013-09-20 14:10:46 +02:00
Tom Christie
3fba60e99c Drop broken placeholder serializations. 2013-08-30 09:02:54 +01:00
Craig de Stigter
94cd136943 add transform_<fieldname> methods to serializers, which basically do the opposite of validate_<fieldname> on a per-field basis. 2013-08-29 17:35:15 +12:00
Tom Christie
18007d6846 Simplifying raw data renderering support 2013-08-28 21:52:56 +01:00
Tom Christie
8d590ebfde First hacky pass at displaying raw data 2013-08-27 11:22:19 +01:00
Tom Christie
ab68d355f5 Merge pull request #1058 from ericbuehl/master
parameterize identity field serializer class to allow for easier subclassing
2013-08-25 12:46:11 -07:00
Eric Buehl
9d3fae27fd parameterize identity field class to allow for easier subclassing 2013-08-23 16:48:32 +00:00
Tom Christie
10d386ec6a Cleanup and dealing with empty form data. 2013-08-23 16:10:20 +01:00
Tom Christie
b72a99fef2 Merge branch 'display-nested-data' into html-form-renderer 2013-08-23 14:39:52 +01:00
Tom Christie
e03854ba6a Tweaks to display nested data in empty serializers 2013-08-23 14:06:14 +01:00
Yuri Prezument
ff1efcf60f If null or blank - don't save the nested object 2013-08-12 21:06:37 +03:00
Tom Christie
fbd4c4ee8f Merge pull request #1030 from etos/patch-2
Spelling correction on read_only_fields err msg
2013-08-12 01:25:36 -07:00
Dan Stephenson
bbdcbe9452 Spelling correction on read_only_fields err msg
just spotted extras
2013-08-10 01:22:47 +01:00
Dan Stephenson
edd696292c Spelling correction on read_only_fields err msg 2013-08-10 01:12:36 +01:00
Kevin Brown
103fed9667 Fixed reversed arguments in assertion 2013-07-26 10:59:51 -04:00
Tom Christie
58d38d694e Merge branch 'master' into writable-nested-modelserializer 2013-06-28 09:07:09 +01:00
Tom Christie
69e5e3cc0d Use timezone aware datetimes with oauth2 provider, when supported. Closes #947. 2013-06-26 21:18:13 +01:00
Tom Christie
4ad1094968 HyperlinkedModelSerializer supports overriding of 'url' field. Closes #936 2013-06-17 15:09:36 +01:00
Tom Christie
de00ec95c3 Merge master 2013-06-05 13:33:19 +01:00
Tom Christie
62e59f8277 Merge pull request #900 from copitux/fix-validation-layer
Bugfix: Fix run validation layer with invalid data
2013-06-03 00:49:02 -07:00
Tom Christie
8b73dce51d view_name argument to HyperlinkedModelSerializer is now properly enforced. Closes #471 2013-06-02 19:50:24 +01:00
Tom Christie
d7753123f6 HyperlinkedModelSerializer lookup_field option should apply to HyperlinkedIdentityField 2013-05-31 11:50:37 +01:00
David Medina
d11b55648c Bugfix: Fix run validation layer with invalid data 2013-05-29 12:55:42 +02:00
Pascal Borreli
8f35ac4f93 Fixed typos 2013-05-28 15:09:23 +01:00
Tom Christie
fcaee6e580 Clean up OPTIONS implementation 2013-05-24 23:44:23 +01:00
Tom Christie
760e8642bd Merge branch 'issue-192-expose-fields-for-options' of https://github.com/grimborg/django-rest-framework into improved-options-support 2013-05-24 21:21:56 +01:00
Oscar Vilaplana
a1deb5eac7 simplified, moved field humanizing to Field. broken tests 2013-05-23 08:26:55 +02:00
Tom Christie
cdc3c37465 Merge and styling fixes 2013-05-21 12:01:56 +01:00
Stephan Groß
025c40e7d5 Fix order for applying min_value to fields 2013-05-18 17:16:29 +02:00
Markus Törnqvist
48c1b2233b Merge branch 'master' into mjtorn-master
Conflicts:
	rest_framework/serializers.py
	rest_framework/tests/serializer.py

Fixed conflicts
2013-05-18 18:13:31 +03:00
Stephan Groß
0c81d04170 Add min_value=0 to autogenerated Pos..IntFields 2013-05-18 17:04:20 +02:00
Tom Christie
5f8d353f0b Rename has_user_through_model -> has_through_model 2013-05-18 15:25:49 +01:00
Tom Christie
e1a3cab400 Merge pull request #854 from ryankask/issue-775
All relations pointing to ManyToManyFields should default to read-only
2013-05-18 07:22:22 -07:00
Tom Christie
cc39b9c925 Merge pull request #858 from minddust/fix_710
Fix for #710
2013-05-18 07:19:52 -07:00