summaryrefslogtreecommitdiff
path: root/django/contrib/postgres
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/postgres')
-rw-r--r--django/contrib/postgres/fields/array.py3
-rw-r--r--django/contrib/postgres/fields/hstore.py5
-rw-r--r--django/contrib/postgres/fields/ranges.py3
-rw-r--r--django/contrib/postgres/forms/array.py3
-rw-r--r--django/contrib/postgres/forms/hstore.py3
-rw-r--r--django/contrib/postgres/forms/jsonb.py7
6 files changed, 9 insertions, 15 deletions
diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py
index b70ae37a3a..dc5b9b8d6b 100644
--- a/django/contrib/postgres/fields/array.py
+++ b/django/contrib/postgres/fields/array.py
@@ -6,7 +6,6 @@ from django.contrib.postgres.validators import ArrayMaxLengthValidator
from django.core import checks, exceptions
from django.db.models import Field, IntegerField, Transform
from django.db.models.lookups import Exact, In
-from django.utils import six
from django.utils.translation import ugettext_lazy as _
from ..utils import prefix_validation_error
@@ -98,7 +97,7 @@ class ArrayField(Field):
return name, path, args, kwargs
def to_python(self, value):
- if isinstance(value, six.string_types):
+ if isinstance(value, str):
# Assume we're deserializing
vals = json.loads(value)
value = [self.base_field.to_python(val) for val in vals]
diff --git a/django/contrib/postgres/fields/hstore.py b/django/contrib/postgres/fields/hstore.py
index 605deaf62c..fcd212bc4a 100644
--- a/django/contrib/postgres/fields/hstore.py
+++ b/django/contrib/postgres/fields/hstore.py
@@ -4,7 +4,6 @@ from django.contrib.postgres import forms, lookups
from django.contrib.postgres.fields.array import ArrayField
from django.core import exceptions
from django.db.models import Field, TextField, Transform
-from django.utils import six
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
@@ -30,7 +29,7 @@ class HStoreField(Field):
def validate(self, value, model_instance):
super(HStoreField, self).validate(value, model_instance)
for key, val in value.items():
- if not isinstance(val, six.string_types) and val is not None:
+ if not isinstance(val, str) and val is not None:
raise exceptions.ValidationError(
self.error_messages['not_a_string'],
code='not_a_string',
@@ -38,7 +37,7 @@ class HStoreField(Field):
)
def to_python(self, value):
- if isinstance(value, six.string_types):
+ if isinstance(value, str):
value = json.loads(value)
return value
diff --git a/django/contrib/postgres/fields/ranges.py b/django/contrib/postgres/fields/ranges.py
index ab7708d288..840417a58f 100644
--- a/django/contrib/postgres/fields/ranges.py
+++ b/django/contrib/postgres/fields/ranges.py
@@ -4,7 +4,6 @@ from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range
from django.contrib.postgres import forms, lookups
from django.db import models
-from django.utils import six
from .utils import AttributeSetter
@@ -45,7 +44,7 @@ class RangeField(models.Field):
return value
def to_python(self, value):
- if isinstance(value, six.string_types):
+ if isinstance(value, str):
# Assume we're deserializing
vals = json.loads(value)
for end in ('lower', 'upper'):
diff --git a/django/contrib/postgres/forms/array.py b/django/contrib/postgres/forms/array.py
index 9830c8de48..9a9e871a43 100644
--- a/django/contrib/postgres/forms/array.py
+++ b/django/contrib/postgres/forms/array.py
@@ -6,7 +6,6 @@ from django.contrib.postgres.validators import (
ArrayMaxLengthValidator, ArrayMinLengthValidator,
)
from django.core.exceptions import ValidationError
-from django.utils import six
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
@@ -31,7 +30,7 @@ class SimpleArrayField(forms.CharField):
def prepare_value(self, value):
if isinstance(value, list):
- return self.delimiter.join(six.text_type(self.base_field.prepare_value(v)) for v in value)
+ return self.delimiter.join(str(self.base_field.prepare_value(v)) for v in value)
return value
def to_python(self, value):
diff --git a/django/contrib/postgres/forms/hstore.py b/django/contrib/postgres/forms/hstore.py
index 76d362999d..25dceb9fb0 100644
--- a/django/contrib/postgres/forms/hstore.py
+++ b/django/contrib/postgres/forms/hstore.py
@@ -2,7 +2,6 @@ import json
from django import forms
from django.core.exceptions import ValidationError
-from django.utils import six
from django.utils.translation import ugettext_lazy as _
__all__ = ['HStoreField']
@@ -44,7 +43,7 @@ class HStoreField(forms.CharField):
# Cast everything to strings for ease.
for key, val in value.items():
if val is not None:
- val = six.text_type(val)
+ val = str(val)
value[key] = val
return value
diff --git a/django/contrib/postgres/forms/jsonb.py b/django/contrib/postgres/forms/jsonb.py
index 719de3ae66..28429c7172 100644
--- a/django/contrib/postgres/forms/jsonb.py
+++ b/django/contrib/postgres/forms/jsonb.py
@@ -1,17 +1,16 @@
import json
from django import forms
-from django.utils import six
from django.utils.translation import ugettext_lazy as _
__all__ = ['JSONField']
-class InvalidJSONInput(six.text_type):
+class InvalidJSONInput(str):
pass
-class JSONString(six.text_type):
+class JSONString(str):
pass
@@ -36,7 +35,7 @@ class JSONField(forms.CharField):
code='invalid',
params={'value': value},
)
- if isinstance(converted, six.text_type):
+ if isinstance(converted, str):
return JSONString(converted)
else:
return converted