Laurent De Marez
fdde44d9d1
Fix parsing multipart data using a nested serializer with list ( #3820 )
...
It is possible that a key in a MultiValueDict has multiple values, lists
are represented this way. When accessing a key in a MultiValueDict
it only returns the last element of that key. This becomes a problem
when parsing an html dict with a list inside of it.
To fix this problem we have to get and set the value using .getlist()
and .setlist().
2016-06-23 16:03:24 +01:00
Tom Christie
9bffd35432
Handle bytestrings in JSON. Closes #4185 . ( #4191 )
2016-06-13 10:41:50 +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
Tom Christie
994e1ba927
Django 1.10 support. ( #4158 )
...
* Added TEMPLATES setting to tests
* Remove deprecated view-string in URL conf
* Replace 'urls = ...' in test classes with override_settings('ROOT_URLCONF=...')
* Refactor UsingURLPatterns to use override_settings(ROOT_URLCONF=...) style
* Get model managers and names in a version-compatible manner.
* Apply override_settings to a TestCase, not a mixin class
* Use '.callback' property instead of private attributes when inspecting urlpatterns
* Pass 'user' to template explicitly
* Correct sorting of import statements.
* Remove unused TEMPLATE_LOADERS setting, in favor of TEMPLATES.
* Remove code style issue
* BaseFilter test requires a concrete model
* Resolve tox.ini issues
* Resolve isort differences between local and tox environments
2016-06-01 15:31:00 +01:00
Ben Brostoff
400078311b
Fix typos in ReturnDict and ReturnList docstrings
2016-05-16 20:39:13 -04:00
Xavier Ordoquy
cfb77ae6fa
Merge pull request #3273 from olliewalsh/breadcrumbs_view_name
...
Do not ignore overridden View.get_view_name() in breadcrumbs
2016-03-23 01:10:13 +01:00
Stephan Groß
a101251a2a
Fix blank lines around docstrings
2016-03-17 11:06:47 +00: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
Kevin Brown
a772326112
Merged two DecimalValidator tests together
...
These two tests were previously added in
7d79cf35b7
but we have now discovered that there are not actually two separate
cases, there was just a bug in the code that made it look that way.
This also removes a redundant check to see if `DecimalValidator` was
defined.
2016-01-04 10:22:17 -05:00
Kevin Brown
87605e1e39
Don't filter out the DecimalValidator if it is not supported
...
Previously, all validators set on a DecimalField in Django would be
stripped when converted to a Django REST framework field. This was
because any validator that was an instance of `DecimalValidator` would
be removed, and when `DecimalValidator` wasn't supported (so it was
`None`), all validators would be removed.
This fixes the issue by only removing the `DecimalValidator` instances
if the `DecimalValidator` is supported.
2015-12-24 14:10:48 -05:00
Tom Christie
8dea1aeed0
Merge pull request #3677 from Ernest0x/patch-4
...
Updated NestedBoundField to also handle empty string when rendering its form
2015-11-27 13:21:58 +00: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
Aarni Koskela
47c9bb143c
Fix smart_repr()
to also clean upper-case hex addresses.
...
Windows Pythons seem to like printing addresses in upper-case, while Linux
Pythons like lower-case hexes.
This led to an amusing (for a given value of "amusing", anyway) situation
where some repr tests would fail if the objects they were testing happened
to be allocated at an address with a hex digit in the range A..F.
2015-11-26 15:48:04 +02:00
Andrei Fokau
2acc6a756c
Use related_objects api for Django 1.9+
2015-11-19 13:04:37 +01:00
Martin Hill
ff36cbe4ba
same logic, more pythonic
2015-11-14 23:04:32 -05:00
Martin Hill
bac6f1fcf4
check if field.to_fields is None
2015-11-14 18:26:29 -05:00
Martin Hill
e475464945
fix for issue #3634
2015-11-14 17:00:07 -05:00
José Padilla
41d1e42e9c
Add compat util for DecimalValidator
2015-10-29 06:42:16 -04:00
Matthew Madurski
8aed3d4862
Correctly handle false in nested as_form_field
2015-10-24 19:48:17 -04:00
José Padilla
d64bfef56a
Map all supported FilePathField options
2015-10-23 10:08:29 -04:00
likeon
322bda8159
Added support for the to_field on ForeignKey fields
2015-10-21 15:33:18 +03:00
José Padilla
a1dad503cf
Map TextField max_length to CharField
2015-10-16 07:17:33 -04:00
Tom Christie
02e1f69d2b
Django 1.9 support
2015-09-28 11:44:07 +01:00
Tom Christie
2d0b54e263
Merge branch 'drop-django-16' oft https://github.com/carltongibson/django-rest-framework into carltongibson-drop-django-16
...
Conflicts:
docs/topics/release-notes.md
2015-09-28 11:17:48 +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
Stian Jensen
62c000bc12
Use model error_messages when available
...
In the automatically applied UniqueValidator, use the error message from
error_messages defined in the model instead of the generic default
UniqueValidator message.
This fixes #2878 .
2015-09-23 15:20:44 +02:00
Carlton Gibson
45ace5010e
Remove OrderedDict fallback
2015-09-22 16:35:38 +02:00
Carlton Gibson
6e86a53c92
Remove apps.get_model
fallback
...
* Corrects presumed logic error in `ResolveModelWithPatchedDjangoTests`
2015-09-22 16:14:45 +02:00
Carlton Gibson
8ea1606abf
Remove Django 1.5 clean_manytomany_helptext fallback
2015-09-21 20:16:52 +02:00
Tom Christie
a3067bea55
Merge branch 'master' into version-3.3
2015-09-17 16:24:46 +01:00
Tom Christie
f9d1a34fdd
Fix nested HTML dictionaries. Closes #3314 .
2015-09-03 11:23:58 +01:00
Tom Christie
afd2a8f8f0
Adjust ModelField.null mappings now that Django-25320 is resolved
2015-09-03 10:12:52 +01:00
Tom Christie
78632849cf
Comment against model_field.null 1.98 behavior
2015-08-28 13:29:57 +01:00
Tom Christie
8db6367188
Deal with 1.9's differing null behavior on reverse relationships and m2m
2015-08-28 12:08:32 +01:00
Tom Christie
4f27697467
Fix get_model import
2015-08-27 17:28:12 +01:00
Tom Christie
b6c4d8c25a
Resolve duplicate error for IPAddressField. Closes #3250 .
2015-08-20 12:38:48 +01:00
Ollie Walsh
332c30afb9
Lint
2015-08-14 12:20:25 +01:00
Ollie Walsh
3d0292e1cd
Do not ignore overridden View.get_view_name() in breadcrumbs
2015-08-14 12:16:57 +01: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
27ac5a3680
Support grouped choices
2015-08-06 11:43:03 +01:00
Tom Christie
6161ac7d07
Fix parse_html_dict signature. Closes #3212 .
2015-08-05 13:45:56 +01:00
Tom Christie
650866cc43
Blank relational fields map to required=False serializer fields. Closes #3210 .
2015-08-03 09:48:03 +01:00
Tom Christie
e68d737825
Respect blank on many to many, and set allow_empty=False if it is not present. Closes #2804 .
2015-07-30 17:03:08 +01:00
Tom Christie
b996266431
Merge master
2015-07-23 15:28:29 +01: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
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
Tom Christie
8d4c96ecd6
Merge pull request #3012 from jannon/fix-allow-blank-mapping
...
only include 'allow_blank' on supported fields
2015-06-24 11:01:10 +01:00
Tom Christie
e3b578258a
Merge pull request #2769 from nonZero/patch-1
...
Wrong error message on bad field lookup
2015-06-22 17:04:04 +01:00
Jannon Frank
2c415d7e03
models.TextFields get mapped to serializers.CharField too
2015-06-16 14:05:19 -07:00
Jannon Frank
b0752217ae
only include 'allow_blank' on CharField
2015-06-05 02:21:13 -07:00
Tom Christie
ec8e7f27e7
Fixes for format preservation
2015-05-19 15:49:37 +01:00
Udi Oron
b95ef25cbb
Wrong error message on bad field lookup
2015-03-26 20:13:35 +02:00
Ilias Kiourktsidis
0888f9cfc3
Use _meta instead of Meta on is_abstract_model function
2015-03-25 12:00:20 +00:00
Ilias Kiourktsidis
486f0a9367
Raise error when ModelSerializer used with abstract model
2015-03-23 15:01:19 +00:00
Tom Christie
dbd2352165
Fixes for latest pep8 updates. Refs #2563 .
2015-02-17 10:58:00 +00:00
Tom Christie
4ee4b4f2dc
Merge master
2015-01-30 14:00:25 +00:00
Tom Christie
889a07f556
Support assignment in ClassLookupDict
2015-01-23 15:32:21 +00:00
Tom Christie
39f26c9eca
Merge master
2015-01-23 14:28:59 +00:00
Tom Christie
25a703b42c
Work around meta API differences
2015-01-23 11:15:11 +00:00
Tom Christie
e59b3d1718
Make ReturnDict cachable. Closes #2360 .
2015-01-21 14:18:13 +00: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
6065cdbd93
Merge master
2015-01-19 15:16:57 +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
da1db34a36
Handle UUID objects in JSONEncoder. Closes #2433 .
2015-01-19 14:19:01 +00:00
Fabien Bochu
5484d570cb
Fix timedelta JSON serialization on Python 2.6.
2015-01-19 13:09:08 +01:00
Tom Christie
86d2774cf3
Fix compat issues
2015-01-16 20:30:46 +00:00
Tom Christie
f13fcba9a9
Include paragraph around view description in browable API
2015-01-14 13:20:02 +00:00
Tom Christie
4d287c7aef
Include paragraph around view description in browable API
2015-01-14 13:19:56 +00:00
Tom Christie
6168f60ba8
Merge branch 'master' into version-3.1
2015-01-05 11:02:28 +00:00
Tom Christie
8cf3744971
Ensure no invalid min_length/min_value/max_value arguments. Closes #2369 .
2015-01-05 10:52:18 +00:00
Kyle Valade
a7479721c8
First pass at refactoring get_field_info in utils.model_meta
2014-12-29 00:35:00 -08:00
Tom Christie
ef2eff2aba
Only pass max_length for CharField. Closes #2317 .
2014-12-28 11:07:38 +00:00
Remi Paulmier
6c5ff71278
fix the way to use textarea rather than input with models.TextField
2014-12-22 18:05:07 +01:00
Tom Christie
2a1485e009
Final bits of docs for ModelSerializer fields API
2014-12-19 21:32:43 +00:00
Tom Christie
a68d9331fc
YAML encoder fix for 3.0 serializers.
2014-12-18 12:17:46 +00:00
Tom Christie
b6ee784240
Merge master
2014-12-15 12:18:55 +00:00
Tom Christie
dc66cce16d
Remove erronous print
2014-12-15 12:01:29 +00:00
Tom Christie
72e08a3e8b
Use unicode internally everywhere for 'repr'
2014-12-15 11:55:17 +00:00
Tom Christie
8934e61b67
Merge branch 'jpadilla-exception-handler-context' into version-3.1
2014-12-15 09:20:27 +00:00
Tom Christie
5e7c9687c7
First pass at serializer repr bug
2014-12-15 09:13:02 +00:00
Tom Christie
baaa356489
Merge master
2014-12-12 15:37:43 +00:00
Tom Christie
7d70e56ce3
Copy model field validators, don't reuse the same list.
2014-12-09 16:25:10 +00:00
José Padilla
afe7ed9333
Add allow_blank for ChoiceField #2184
...
This makes a ChoiceField optional in HTML if
model field has `blank=True` set.
2014-12-09 09:25:06 -04:00
Tymur Maryokhin
d54c67d79d
Removed custom StringIO, force_text, smart_text compat
2014-12-04 03:11:42 +01:00
Tymur Maryokhin
09e59f2686
Removed custom python_2_unicode_compatible. Closes #2183
2014-12-04 02:50:25 +01:00
Tom Christie
33096a1de6
BindingDict inherits from collections.MutableMapping. Closes #2135 .
2014-12-02 15:15:21 +00:00
José Padilla
731c8421af
Remove YAML support from core
2014-11-29 14:43:05 -04:00
Tom Christie
3a5b3772fe
Use ImproperlyConfigured when model meta lookup fails
2014-11-28 15:36:04 +00:00
Doug Beck
67735687b2
Ensure _resolve_model
does not return None
2014-11-18 01:26:23 -05:00
Tom Christie
4e03518438
required=False for nullable relationships
2014-11-13 23:30:42 +00:00
Tom Christie
cb672a0ecb
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
2014-11-13 22:16:53 +00:00
Tom Christie
ea98de9b88
Model fields with .blank or .null now map to required=False. Closes #2017 . Closes #2021 .
2014-11-13 19:28:57 +00:00