mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 04:20:12 +03:00
Move postgres_fields import out of compat.py
This commit is contained in:
parent
de202e4acd
commit
99d120b2e4
|
@ -115,15 +115,6 @@ def _resolve_model(obj):
|
|||
raise ValueError("{0} is not a Django model".format(obj))
|
||||
|
||||
|
||||
|
||||
# TODO: Remove
|
||||
# contrib.postgres only supported from 1.8 onwards.
|
||||
try:
|
||||
from django.contrib.postgres import fields as postgres_fields
|
||||
except ImportError:
|
||||
postgres_fields = None
|
||||
|
||||
|
||||
# TODO: Remove
|
||||
# JSONField is only supported from 1.9 onwards
|
||||
try:
|
||||
|
|
|
@ -28,7 +28,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, set_many, unicode_to_repr
|
||||
from rest_framework.compat import set_many, unicode_to_repr
|
||||
from rest_framework.exceptions import ErrorDetail, ValidationError
|
||||
from rest_framework.fields import get_error_detail, set_value
|
||||
from rest_framework.settings import api_settings
|
||||
|
@ -46,6 +46,12 @@ from rest_framework.validators import (
|
|||
UniqueTogetherValidator
|
||||
)
|
||||
|
||||
try:
|
||||
from django.contrib.postgres import fields as postgres_fields
|
||||
except ImportError:
|
||||
postgres_fields = None
|
||||
|
||||
|
||||
# Note: We do the following so that users of the framework can use this style:
|
||||
#
|
||||
# example_field = serializers.CharField(...)
|
||||
|
|
Loading…
Reference in New Issue
Block a user