datatracker/patch/fix-django-unicode-comparison-bug.patch
2019-01-21 18:04:17 +00:00

23 lines
959 B
Diff

--- django/db/models/fields/__init__.py.old 2017-06-14 08:43:21.665812000 -0700
+++ django/db/models/fields/__init__.py 2017-12-17 14:34:03.023976702 -0800
@@ -2340,7 +2340,7 @@
if self.has_default() and not callable(self.default):
return self.default
default = super(BinaryField, self).get_default()
- if default == '':
+ if isinstance(default, six.text_type) and default == '':
return b''
return default
--- django/forms/widgets.py.old 2018-02-21 15:17:40.742742712 -0800
+++ django/forms/widgets.py 2018-02-21 15:19:57.182002508 -0800
@@ -195,7 +195,7 @@
"""
Return a value as it should appear when rendered in a template.
"""
- if value == '' or value is None:
+ if value is None or isinstance(value, six.string_types) and len(value) == 0:
return None
if self.is_localized:
return formats.localize_input(value)