From 16cc63ffaa86ee56410fb4ea4ab4191c32a7e6e1 Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Sun, 5 Jun 2016 01:53:11 +0600 Subject: [PATCH 1/2] removed contrib.postgres compat shim --- rest_framework/compat.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index dd30636f4..9a3fa5f58 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -128,13 +128,6 @@ def value_from_object(field, obj): field.value_from_object(obj) -# contrib.postgres only supported from 1.8 onwards. -try: - from django.contrib.postgres import fields as postgres_fields -except ImportError: - postgres_fields = None - - # JSONField is only supported from 1.9 onwards try: from django.contrib.postgres.fields import JSONField From 6e52326d91b8fb9ddb7af8c8ed21503bfe174080 Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Sun, 5 Jun 2016 02:17:43 +0600 Subject: [PATCH 2/2] adjusted import --- rest_framework/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 698730f53..ae080b628 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -14,6 +14,7 @@ from __future__ import unicode_literals import warnings +from django.contrib.postgres import fields as postgres_fields from django.db import models from django.db.models import DurationField as ModelDurationField from django.db.models.fields import Field as DjangoModelField @@ -22,7 +23,7 @@ from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ from rest_framework.compat import JSONField as ModelJSONField -from rest_framework.compat import postgres_fields, unicode_to_repr +from rest_framework.compat import unicode_to_repr from rest_framework.utils import model_meta from rest_framework.utils.field_mapping import ( ClassLookupDict, get_field_kwargs, get_nested_relation_kwargs,