Berkant Kepez
5c9bd01b5f
Fix #7722 .
...
Render BooleanFields with allow_null=True as HTML select rather than as
HTML checkbox in Browsable API #7722 .
2021-03-29 16:38:20 +02:00
Alex Hedlund
b256c46cb1
Render JSON fields with proper indentation in browsable API forms. ( #6243 )
...
* Fix JSONBoundField usage on nested serializers (#6211 )
* Unify JSONBoundField as_form_field output between py2 and py3
When using json.dumps with indenting, in python2 the default formatting
prints whitespace after commas (,) and python3 does not. This can be
unified with the separators keyword argument.
2021-03-15 10:44:03 +00:00
Berkant
95ae92ef23
Fix #7706 ( #7724 )
...
Handle non-dict values for NestedSerializer during BrowsableAPI
rendering.
2021-03-09 11:34:18 +00:00
Gregory N. Schmit
335054a5d3
replace force_text with force_str
2019-08-07 21:05:24 +02:00
Jon Dufresne
ff86f09f74
Remove unnecessary compatibility shims from rest_framework/compat.py ( #6631 )
...
For Python 3, collections.abc.Mapping and collections.abc.MutableMapping
are always available from the stdlib.
2019-05-01 07:44:33 +02:00
Carlton Gibson
0407a0df8a
Dropped Python 2 compatibility. ( #6615 )
...
Thanks to Jon Dufresne (@jdufresne) for review.
Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com>
2019-04-30 17:53:44 +02:00
Charlie Hornsby
07c5c968ce
Fix DeprecationWarning when accessing collections.abc classes via collections ( #6268 )
...
* Use compat version of collections.abc.Mapping
Since the Mapping class will no longer be available to import directly
from the collections module in Python 3.8, we should use the
compatibility helper introduced in #6154 in the fields module.
* Alias and use compat version of collections.abc.MutableMapping
Since the MutableMapping class will no longer be available to import
directly from the collections module in Python 3.8, we should create an
alias for it in the compat module and use that instead.
2019-02-25 09:17:04 +01:00
Jamie Cockburn
91fa8b923a
Stop JSONBoundField mangling invalid JSON ( #5526 ) ( #5527 )
2017-10-25 10:54:38 +02:00
Ryan P Kilby
c98223f231
Pass on invalid value (Inf, NaN) encoding in JSONBoundField
2017-09-25 09:08:20 +02:00
Ryan P Kilby
d740bae95a
Update json imports
2017-09-25 09:08:20 +02:00
Tom Christie
d2d0a06faf
Merge pull request #5084 from Nerlin/fix-render-required-nested-serializer-error
...
Fixed render error of required nested serializer.
2017-05-02 10:05:25 +01:00
Dave Allan
f56b117064
Pass non-JSON serializable values through unmodified
2017-04-26 14:10:47 -04:00
Dave Allan
7a0bd1c4d1
Use text area for JSON fields and indent JSON
2017-04-26 14:10:47 -04:00
Dave Allan
11d8e4df88
PoC Add JSONBoundField to serializers ( Fixes #4999 )
...
Per issue #4999 , JSONFields are not rendered properly in the DRF
browsable API HTML forms. This patch attempts to fix that behavior by
introducing a JSONBoundField helper similar to the NestedBoundField
helper.
2017-04-26 14:10:47 -04:00
nerlin
ed72603d35
Fixed render error of required nested serializer.
...
Fixes an error that occurs on rendering response with error that says that required nested serializer field must be specified in data.
2017-04-19 03:18:52 +03:00
Tom Christie
8105a4ac5a
Resolve form display with ChoiceField, MultipleChoiceField and non-string choices. ( #4374 )
...
* Add tests for html-form-rendering choice fields
* Resolve issues with ChoiceField, MultipleChoiceField and non-string options
* Ensure None template comparisons don't match string None
2016-08-10 12:02:33 +01:00
Ben Brostoff
400078311b
Fix typos in ReturnDict and ReturnList docstrings
2016-05-16 20:39:13 -04:00
Petros Moisiadis
570187b959
Updated NestedBoundField to also handle empty string when rendering its form
...
If a NestedBoundField field has a value of `None` and is inside another NestedBoundField field, it will have its value converted to an empty string while the form of its enclosing field is being rendered. So, NestedBoundField fields with an empty string value must be handled the same way as NestedBoundField fields with a `None` value.
2015-11-26 17:07:57 +02:00
Matthew Madurski
8aed3d4862
Correctly handle false in nested as_form_field
2015-10-24 19:48:17 -04:00
Carlton Gibson
45ace5010e
Remove OrderedDict fallback
2015-09-22 16:35:38 +02:00
Jeffrey de Lange
f5a9904cc8
Resolved issue with rendering of nested serializers form when value is None
2015-08-11 20:27:41 +02:00
Tom Christie
a3e64fbe0d
Resolve issue with rendering nested serializer forms with empty values. Closes #3260 .
2015-08-11 16:25:02 +01:00
Tom Christie
83e49dbe63
Fix checkbox input display. Refs #3258 .
2015-08-11 09:23:49 +01:00
Tymur Maryokhin
4e5da16961
Remove Django 1.4 compat code
2015-08-07 00:02:29 +02:00
Tom Christie
92008d3d16
None -> '' in the context of form field values
2015-07-23 14:36:23 +01:00
Tom Christie
a8acdbc388
Resolve issue with nested serializers in HTML forms. Closes #3153 .
2015-07-16 12:04:38 +01:00
Tom Christie
7315ed8b00
Resolve browsable API form issues with nested serializers. Closes #3153 .
2015-07-16 10:49:00 +01:00
Tom Christie
6b08e97b6a
Form fields should use textual only value representations. Closes #3139 . Closes #2416 . Closes #2558 .
2015-07-14 15:47:13 +01:00
José Padilla
83c9136c90
Cleanup import following PEP 8 style guide
2015-06-25 16:10:17 -04:00
Tom Christie
e59b3d1718
Make ReturnDict cachable. Closes #2360 .
2015-01-21 14:18:13 +00:00
Tom Christie
da6ef3d0b0
Allow missing fields option for inherited serializers. Closes #2388 .
2015-01-21 13:03:37 +00:00
Tom Christie
0dffc46cb7
ReturnDict and ReturnList repr as standard dict/list. Closes #2421 .
2015-01-19 14:21:09 +00:00
Tom Christie
72e08a3e8b
Use unicode internally everywhere for 'repr'
2014-12-15 11:55:17 +00:00
Tom Christie
33096a1de6
BindingDict inherits from collections.MutableMapping. Closes #2135 .
2014-12-02 15:15:21 +00:00
Tom Christie
a16a8a10a9
.copy() for serializer .data and .errors dictionaries
2014-11-07 11:16:26 +00:00
Tom Christie
9b19b5a594
Serializer cleanup
2014-11-07 10:13:46 +00:00