mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Sort imports with isort
This commit is contained in:
parent
83c9136c90
commit
7351a3f6ca
|
@ -9,9 +9,9 @@ from django.contrib.auth import authenticate
|
||||||
from django.middleware.csrf import CsrfViewMiddleware
|
from django.middleware.csrf import CsrfViewMiddleware
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from rest_framework.compat import get_user_model
|
from rest_framework import HTTP_HEADER_ENCODING, exceptions
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
from rest_framework import exceptions, HTTP_HEADER_ENCODING
|
from rest_framework.compat import get_user_model
|
||||||
|
|
||||||
|
|
||||||
def get_authorization_header(request):
|
def get_authorization_header(request):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models, migrations
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import os
|
|
||||||
import binascii
|
import binascii
|
||||||
|
import os
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
|
|
||||||
# Prior to Django 1.5, the AUTH_USER_MODEL setting does not exist.
|
# Prior to Django 1.5, the AUTH_USER_MODEL setting does not exist.
|
||||||
# Note that we don't perform this code in the compat module due to
|
# Note that we don't perform this code in the compat module due to
|
||||||
# bug report #1297
|
# bug report #1297
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from rest_framework import parsers, renderers
|
from rest_framework import parsers, renderers
|
||||||
from rest_framework.views import APIView
|
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
from rest_framework.authtoken.serializers import AuthTokenSerializer
|
from rest_framework.authtoken.serializers import AuthTokenSerializer
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
|
||||||
class ObtainAuthToken(APIView):
|
class ObtainAuthToken(APIView):
|
||||||
|
|
|
@ -9,11 +9,12 @@ from __future__ import unicode_literals
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from django.utils import six
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection, transaction
|
|
||||||
from django.utils.encoding import force_text
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.db import connection, transaction
|
||||||
|
from django.test.client import FakePayload
|
||||||
|
from django.utils import six
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.six.moves.urllib.parse import urlparse as _urlparse
|
from django.utils.six.moves.urllib.parse import urlparse as _urlparse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -202,7 +203,6 @@ if 'patch' not in View.http_method_names:
|
||||||
View.http_method_names = View.http_method_names + ['patch']
|
View.http_method_names = View.http_method_names + ['patch']
|
||||||
|
|
||||||
|
|
||||||
from django.test.client import FakePayload
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# In 1.5 the test client uses force_bytes
|
# In 1.5 the test client uses force_bytes
|
||||||
|
|
|
@ -10,7 +10,8 @@ import math
|
||||||
|
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.utils.translation import ungettext
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,33 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import uuid
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import inspect
|
import inspect
|
||||||
import datetime
|
import re
|
||||||
import collections
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.exceptions import ValidationError as DjangoValidationError
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.core.validators import RegexValidator, ip_address_validators
|
||||||
|
from django.forms import ImageField as DjangoImageField
|
||||||
from django.utils import six, timezone
|
from django.utils import six, timezone
|
||||||
|
from django.utils.dateparse import parse_date, parse_datetime, parse_time
|
||||||
|
from django.utils.encoding import is_protected_type, smart_text
|
||||||
from django.utils.ipv6 import clean_ipv6_address
|
from django.utils.ipv6 import clean_ipv6_address
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.forms import ImageField as DjangoImageField
|
|
||||||
from django.utils.encoding import is_protected_type, smart_text
|
|
||||||
from django.core.validators import RegexValidator, ip_address_validators
|
|
||||||
from django.utils.dateparse import parse_date, parse_datetime, parse_time
|
|
||||||
from django.core.exceptions import (
|
|
||||||
ObjectDoesNotExist, ValidationError as DjangoValidationError
|
|
||||||
)
|
|
||||||
|
|
||||||
from rest_framework import ISO_8601
|
from rest_framework import ISO_8601
|
||||||
from rest_framework.settings import api_settings
|
|
||||||
from rest_framework.exceptions import ValidationError
|
|
||||||
from rest_framework.utils import html, representation, humanize_datetime
|
|
||||||
from rest_framework.compat import (
|
from rest_framework.compat import (
|
||||||
EmailValidator, MinValueValidator, MaxValueValidator,
|
EmailValidator, MaxLengthValidator, MaxValueValidator, MinLengthValidator,
|
||||||
MinLengthValidator, MaxLengthValidator, URLValidator, OrderedDict,
|
MinValueValidator, OrderedDict, URLValidator, duration_string,
|
||||||
unicode_repr, unicode_to_repr, parse_duration, duration_string,
|
parse_duration, unicode_repr, unicode_to_repr
|
||||||
)
|
)
|
||||||
|
from rest_framework.exceptions import ValidationError
|
||||||
|
from rest_framework.settings import api_settings
|
||||||
|
from rest_framework.utils import html, humanize_datetime, representation
|
||||||
|
|
||||||
|
|
||||||
class empty:
|
class empty:
|
||||||
|
|
|
@ -7,13 +7,12 @@ from __future__ import unicode_literals
|
||||||
import operator
|
import operator
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
from django.db import models
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.db import models
|
||||||
|
from django.utils import six
|
||||||
|
|
||||||
|
from rest_framework.compat import django_filters, get_model_name, guardian
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.compat import django_filters, guardian, get_model_name
|
|
||||||
|
|
||||||
|
|
||||||
FilterSet = django_filters and django_filters.FilterSet or None
|
FilterSet = django_filters and django_filters.FilterSet or None
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ Generic views that provide commonly needed behaviour.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.http import Http404
|
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
from django.http import Http404
|
||||||
from django.shortcuts import get_object_or_404 as _get_object_or_404
|
from django.shortcuts import get_object_or_404 as _get_object_or_404
|
||||||
|
|
||||||
from rest_framework import views, mixins
|
from rest_framework import mixins, views
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ to return this information in a more standardized way.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.core.exceptions import PermissionDenied
|
|
||||||
|
|
||||||
from rest_framework import exceptions, serializers
|
from rest_framework import exceptions, serializers
|
||||||
from rest_framework.compat import OrderedDict
|
from rest_framework.compat import OrderedDict
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.http import Http404
|
||||||
from rest_framework import HTTP_HEADER_ENCODING, exceptions
|
from rest_framework import HTTP_HEADER_ENCODING, exceptions
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.utils.mediatypes import (
|
from rest_framework.utils.mediatypes import (
|
||||||
_MediaType, order_by_precedence, media_type_matches
|
_MediaType, media_type_matches, order_by_precedence
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,21 @@ be used for paginated responses.
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from base64 import b64encode, b64decode
|
from base64 import b64decode, b64encode
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from django.utils import six
|
from django.core.paginator import Paginator as DjangoPaginator
|
||||||
|
from django.core.paginator import InvalidPage
|
||||||
from django.template import Context, loader
|
from django.template import Context, loader
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils import six
|
||||||
from django.utils.six.moves.urllib import parse as urlparse
|
from django.utils.six.moves.urllib import parse as urlparse
|
||||||
from django.core.paginator import InvalidPage, Paginator as DjangoPaginator
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework.compat import OrderedDict
|
from rest_framework.compat import OrderedDict
|
||||||
from rest_framework.exceptions import NotFound
|
from rest_framework.exceptions import NotFound
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.utils.urls import (
|
from rest_framework.utils.urls import remove_query_param, replace_query_param
|
||||||
replace_query_param, remove_query_param
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _positive_int(integer_string, strict=False, cutoff=None):
|
def _positive_int(integer_string, strict=False, cutoff=None):
|
||||||
|
|
|
@ -8,16 +8,17 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.files.uploadhandler import StopFutureHandlers
|
||||||
from django.http import QueryDict
|
from django.http import QueryDict
|
||||||
|
from django.http.multipartparser import \
|
||||||
|
MultiPartParser as DjangoMultiPartParser
|
||||||
|
from django.http.multipartparser import (
|
||||||
|
ChunkIter, MultiPartParserError, parse_header
|
||||||
|
)
|
||||||
|
from django.utils import six
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils.six.moves.urllib import parse as urlparse
|
from django.utils.six.moves.urllib import parse as urlparse
|
||||||
from django.core.files.uploadhandler import StopFutureHandlers
|
|
||||||
from django.http.multipartparser import (
|
|
||||||
MultiPartParserError, parse_header, ChunkIter,
|
|
||||||
MultiPartParser as DjangoMultiPartParser
|
|
||||||
)
|
|
||||||
|
|
||||||
from rest_framework import renderers
|
from rest_framework import renderers
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.http import Http404
|
||||||
|
|
||||||
from rest_framework.compat import get_model_name
|
from rest_framework.compat import get_model_name
|
||||||
|
|
||||||
|
|
||||||
SAFE_METHODS = ('GET', 'HEAD', 'OPTIONS')
|
SAFE_METHODS = ('GET', 'HEAD', 'OPTIONS')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.utils import six
|
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
||||||
from django.db.models.query import QuerySet
|
|
||||||
from django.utils.encoding import smart_text
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
from django.utils.six.moves.urllib import parse as urlparse
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
|
|
||||||
from django.core.urlresolvers import (
|
from django.core.urlresolvers import (
|
||||||
get_script_prefix, resolve, NoReverseMatch, Resolver404
|
NoReverseMatch, Resolver404, get_script_prefix, resolve
|
||||||
)
|
)
|
||||||
|
from django.db.models.query import QuerySet
|
||||||
|
from django.utils import six
|
||||||
|
from django.utils.encoding import smart_text
|
||||||
|
from django.utils.six.moves.urllib import parse as urlparse
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from rest_framework.utils import html
|
|
||||||
from rest_framework.reverse import reverse
|
|
||||||
from rest_framework.compat import OrderedDict
|
from rest_framework.compat import OrderedDict
|
||||||
from rest_framework.fields import get_attribute, empty, Field
|
from rest_framework.fields import Field, empty, get_attribute
|
||||||
|
from rest_framework.reverse import reverse
|
||||||
|
from rest_framework.utils import html
|
||||||
|
|
||||||
|
|
||||||
class PKOnlyObject(object):
|
class PKOnlyObject(object):
|
||||||
|
|
|
@ -12,23 +12,23 @@ import json
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils import six
|
|
||||||
from django.core.paginator import Page
|
|
||||||
from django.test.client import encode_multipart
|
|
||||||
from django.http.multipartparser import parse_header
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.template import Context, RequestContext, loader, Template
|
from django.core.paginator import Page
|
||||||
|
from django.http.multipartparser import parse_header
|
||||||
|
from django.template import Context, RequestContext, Template, loader
|
||||||
|
from django.test.client import encode_multipart
|
||||||
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework.utils import encoders
|
from rest_framework import VERSION, exceptions, serializers, status
|
||||||
|
from rest_framework.compat import (
|
||||||
|
INDENT_SEPARATORS, LONG_SEPARATORS, SHORT_SEPARATORS
|
||||||
|
)
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
|
from rest_framework.request import is_form_media_type, override_method
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
from rest_framework.utils import encoders
|
||||||
from rest_framework.utils.breadcrumbs import get_breadcrumbs
|
from rest_framework.utils.breadcrumbs import get_breadcrumbs
|
||||||
from rest_framework.utils.field_mapping import ClassLookupDict
|
from rest_framework.utils.field_mapping import ClassLookupDict
|
||||||
from rest_framework import exceptions, serializers, status, VERSION
|
|
||||||
from rest_framework.request import is_form_media_type, override_method
|
|
||||||
from rest_framework.compat import (
|
|
||||||
SHORT_SEPARATORS, LONG_SEPARATORS, INDENT_SEPARATORS
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def zero_as_none(value):
|
def zero_as_none(value):
|
||||||
|
|
|
@ -13,13 +13,13 @@ from __future__ import unicode_literals
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import QueryDict
|
from django.http import QueryDict
|
||||||
from django.http.multipartparser import parse_header
|
from django.http.multipartparser import parse_header
|
||||||
|
from django.utils import six
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
|
||||||
from rest_framework import exceptions, HTTP_HEADER_ENCODING
|
from rest_framework import HTTP_HEADER_ENCODING, exceptions
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ The appropriate renderer is called during Django's template response rendering.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.template.response import SimpleTemplateResponse
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.six.moves.http_client import responses
|
from django.utils.six.moves.http_client import responses
|
||||||
from django.template.response import SimpleTemplateResponse
|
|
||||||
|
|
||||||
|
|
||||||
class Response(SimpleTemplateResponse):
|
class Response(SimpleTemplateResponse):
|
||||||
|
|
|
@ -3,9 +3,10 @@ Provide urlresolver functions that return fully qualified URLs or view names
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.core.urlresolvers import reverse as django_reverse
|
||||||
|
from django.core.urlresolvers import NoReverseMatch
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.functional import lazy
|
from django.utils.functional import lazy
|
||||||
from django.core.urlresolvers import NoReverseMatch, reverse as django_reverse
|
|
||||||
|
|
||||||
|
|
||||||
def reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):
|
def reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):
|
||||||
|
|
|
@ -19,16 +19,15 @@ import itertools
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.core.urlresolvers import NoReverseMatch
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.core.urlresolvers import NoReverseMatch
|
||||||
|
|
||||||
from rest_framework import views
|
from rest_framework import views
|
||||||
from rest_framework.reverse import reverse
|
from rest_framework.compat import OrderedDict, get_resolver_match
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.compat import get_resolver_match, OrderedDict
|
from rest_framework.reverse import reverse
|
||||||
from rest_framework.urlpatterns import format_suffix_patterns
|
from rest_framework.urlpatterns import format_suffix_patterns
|
||||||
|
|
||||||
|
|
||||||
Route = namedtuple('Route', ['url', 'mapping', 'name', 'initkwargs'])
|
Route = namedtuple('Route', ['url', 'mapping', 'name', 'initkwargs'])
|
||||||
DynamicDetailRoute = namedtuple('DynamicDetailRoute', ['url', 'name', 'initkwargs'])
|
DynamicDetailRoute = namedtuple('DynamicDetailRoute', ['url', 'name', 'initkwargs'])
|
||||||
DynamicListRoute = namedtuple('DynamicListRoute', ['url', 'name', 'initkwargs'])
|
DynamicListRoute = namedtuple('DynamicListRoute', ['url', 'name', 'initkwargs'])
|
||||||
|
|
|
@ -15,29 +15,26 @@ from __future__ import unicode_literals
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.db.models.fields import Field as DjangoModelField
|
||||||
|
from django.db.models.fields import FieldDoesNotExist
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.db.models.fields import (
|
|
||||||
FieldDoesNotExist, Field as DjangoModelField
|
|
||||||
)
|
|
||||||
|
|
||||||
|
from rest_framework.compat import DurationField as ModelDurationField
|
||||||
|
from rest_framework.compat import postgres_fields, unicode_to_repr
|
||||||
from rest_framework.utils import model_meta
|
from rest_framework.utils import model_meta
|
||||||
from rest_framework.compat import (
|
from rest_framework.utils.field_mapping import (
|
||||||
postgres_fields, unicode_to_repr, DurationField as ModelDurationField,
|
ClassLookupDict, get_field_kwargs, get_nested_relation_kwargs,
|
||||||
|
get_relation_kwargs, get_url_kwargs
|
||||||
)
|
)
|
||||||
from rest_framework.utils.serializer_helpers import (
|
from rest_framework.utils.serializer_helpers import (
|
||||||
ReturnDict, ReturnList, BoundField, NestedBoundField, BindingDict
|
BindingDict, BoundField, NestedBoundField, ReturnDict, ReturnList
|
||||||
)
|
|
||||||
from rest_framework.utils.field_mapping import (
|
|
||||||
get_url_kwargs, get_field_kwargs, get_relation_kwargs,
|
|
||||||
get_nested_relation_kwargs, ClassLookupDict
|
|
||||||
)
|
)
|
||||||
from rest_framework.validators import (
|
from rest_framework.validators import (
|
||||||
UniqueForDateValidator, UniqueForMonthValidator, UniqueForYearValidator,
|
UniqueForDateValidator, UniqueForMonthValidator, UniqueForYearValidator,
|
||||||
UniqueTogetherValidator
|
UniqueTogetherValidator
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Note: We do the following so that users of the framework can use this style:
|
# Note: We do the following so that users of the framework can use this style:
|
||||||
#
|
#
|
||||||
# example_field = serializers.CharField(...)
|
# example_field = serializers.CharField(...)
|
||||||
|
@ -45,9 +42,8 @@ from rest_framework.validators import (
|
||||||
# This helps keep the separation between model fields, form fields, and
|
# This helps keep the separation between model fields, form fields, and
|
||||||
# serializer fields more explicit.
|
# serializer fields more explicit.
|
||||||
|
|
||||||
from rest_framework.relations import * # NOQA
|
from rest_framework.fields import * # NOQA # isort:skip
|
||||||
from rest_framework.fields import * # NOQA
|
from rest_framework.relations import * # NOQA # isort:skip
|
||||||
|
|
||||||
|
|
||||||
# We assume that 'validators' are intended for the child serializer,
|
# We assume that 'validators' are intended for the child serializer,
|
||||||
# rather than the parent serializer.
|
# rather than the parent serializer.
|
||||||
|
|
|
@ -19,14 +19,13 @@ back to the defaults.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.signals import setting_changed
|
from django.test.signals import setting_changed
|
||||||
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework import ISO_8601
|
from rest_framework import ISO_8601
|
||||||
from rest_framework.compat import importlib
|
from rest_framework.compat import importlib
|
||||||
|
|
||||||
|
|
||||||
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None)
|
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None)
|
||||||
|
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
from __future__ import unicode_literals, absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
|
from django.core.urlresolvers import NoReverseMatch, reverse
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.html import escape
|
from django.utils.encoding import force_text, iri_to_uri
|
||||||
from django.utils.html import smart_urlquote
|
from django.utils.html import escape, smart_urlquote
|
||||||
from django.utils.safestring import SafeData, mark_safe
|
from django.utils.safestring import SafeData, mark_safe
|
||||||
from django.utils.encoding import iri_to_uri, force_text
|
|
||||||
from django.core.urlresolvers import reverse, NoReverseMatch
|
|
||||||
|
|
||||||
from rest_framework.renderers import HTMLFormRenderer
|
from rest_framework.renderers import HTMLFormRenderer
|
||||||
from rest_framework.utils.urls import replace_query_param
|
from rest_framework.utils.urls import replace_query_param
|
||||||
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
# Regex for adding classes to html snippets
|
# Regex for adding classes to html snippets
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from django.utils import six
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import testcases
|
from django.test import testcases
|
||||||
|
from django.test.client import Client as DjangoClient
|
||||||
|
from django.test.client import ClientHandler
|
||||||
|
from django.utils import six
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
from django.test.client import ClientHandler, Client as DjangoClient
|
|
||||||
|
|
||||||
|
from rest_framework.compat import RequestFactory as DjangoRequestFactory
|
||||||
|
from rest_framework.compat import force_bytes_or_smart_bytes
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.compat import (
|
|
||||||
force_bytes_or_smart_bytes, RequestFactory as DjangoRequestFactory
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def force_authenticate(request, user=None, token=None):
|
def force_authenticate(request, user=None, token=None):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import include, url
|
||||||
from django.core.urlresolvers import RegexURLResolver
|
from django.core.urlresolvers import RegexURLResolver
|
||||||
|
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
|
|
@ -17,7 +17,6 @@ from __future__ import unicode_literals
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth import views
|
from django.contrib.auth import views
|
||||||
|
|
||||||
|
|
||||||
template_name = {'template_name': 'rest_framework/login.html'}
|
template_name = {'template_name': 'rest_framework/login.html'}
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.core.urlresolvers import resolve, get_script_prefix
|
from django.core.urlresolvers import get_script_prefix, resolve
|
||||||
|
|
||||||
|
|
||||||
def get_breadcrumbs(url):
|
def get_breadcrumbs(url):
|
||||||
|
|
|
@ -3,15 +3,15 @@ Helper classes for parsers.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import uuid
|
|
||||||
import json
|
|
||||||
import decimal
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import decimal
|
||||||
|
import json
|
||||||
|
import uuid
|
||||||
|
|
||||||
from django.utils import six, timezone
|
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.utils.functional import Promise
|
from django.utils import six, timezone
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
|
from django.utils.functional import Promise
|
||||||
|
|
||||||
from rest_framework.compat import total_seconds
|
from rest_framework.compat import total_seconds
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,13 @@ keyword arguments that should be used for their equivelent serializer fields.
|
||||||
"""
|
"""
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
|
from django.db import models
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
|
|
||||||
from rest_framework.compat import clean_manytomany_helptext
|
from rest_framework.compat import clean_manytomany_helptext
|
||||||
from rest_framework.validators import UniqueValidator
|
from rest_framework.validators import UniqueValidator
|
||||||
|
|
||||||
|
|
||||||
NUMERIC_FIELD_TYPES = (
|
NUMERIC_FIELD_TYPES = (
|
||||||
models.IntegerField, models.FloatField, models.DecimalField
|
models.IntegerField, models.FloatField, models.DecimalField
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,13 +8,12 @@ Usage: `get_field_info(model)` returns a `FieldInfo` instance.
|
||||||
import inspect
|
import inspect
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
from django.db import models
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.db import models
|
||||||
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework.compat import OrderedDict
|
from rest_framework.compat import OrderedDict
|
||||||
|
|
||||||
|
|
||||||
FieldInfo = namedtuple('FieldResult', [
|
FieldInfo = namedtuple('FieldResult', [
|
||||||
'pk', # Model field instance
|
'pk', # Model field instance
|
||||||
'fields', # Dict of field name -> model field instance
|
'fields', # Dict of field name -> model field instance
|
||||||
|
|
|
@ -7,8 +7,8 @@ from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.functional import Promise
|
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
|
from django.utils.functional import Promise
|
||||||
|
|
||||||
from rest_framework.compat import unicode_repr
|
from rest_framework.compat import unicode_repr
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ import re
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from rest_framework import exceptions
|
from rest_framework import exceptions
|
||||||
|
from rest_framework.compat import unicode_http_header
|
||||||
from rest_framework.reverse import _reverse
|
from rest_framework.reverse import _reverse
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.compat import unicode_http_header
|
|
||||||
from rest_framework.utils.mediatypes import _MediaType
|
|
||||||
from rest_framework.templatetags.rest_framework import replace_query_param
|
from rest_framework.templatetags.rest_framework import replace_query_param
|
||||||
|
from rest_framework.utils.mediatypes import _MediaType
|
||||||
|
|
||||||
|
|
||||||
class BaseVersioning(object):
|
class BaseVersioning(object):
|
||||||
|
|
|
@ -6,19 +6,19 @@ from __future__ import unicode_literals
|
||||||
import inspect
|
import inspect
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
from django.http import Http404
|
|
||||||
from django.utils.encoding import smart_text
|
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.http import Http404
|
||||||
|
from django.utils import six
|
||||||
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from rest_framework import status, exceptions
|
from rest_framework import exceptions, status
|
||||||
|
from rest_framework.compat import HttpResponseBase, View, set_rollback
|
||||||
from rest_framework.request import Request
|
from rest_framework.request import Request
|
||||||
from rest_framework.utils import formatting
|
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.compat import HttpResponseBase, View, set_rollback
|
from rest_framework.utils import formatting
|
||||||
|
|
||||||
|
|
||||||
def get_view_name(view_cls, suffix=None):
|
def get_view_name(view_cls, suffix=None):
|
||||||
|
|
|
@ -23,7 +23,7 @@ from functools import update_wrapper
|
||||||
from django.utils.decorators import classonlymethod
|
from django.utils.decorators import classonlymethod
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from rest_framework import views, generics, mixins
|
from rest_framework import generics, mixins, views
|
||||||
|
|
||||||
|
|
||||||
class ViewSetMixin(object):
|
class ViewSetMixin(object):
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import url, include
|
|
||||||
|
from django.conf.urls import include, url
|
||||||
|
|
||||||
from .views import MockView
|
from .views import MockView
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', MockView.as_view()),
|
url(r'^$', MockView.as_view()),
|
||||||
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
|
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from .views import MockView
|
from .views import MockView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from rest_framework.views import APIView
|
from rest_framework import authentication, renderers
|
||||||
from rest_framework import authentication
|
|
||||||
from rest_framework import renderers
|
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
|
||||||
class MockView(APIView):
|
class MockView(APIView):
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
|
||||||
# test strings snatched from http://www.columbia.edu/~fdc/utf8/,
|
# test strings snatched from http://www.columbia.edu/~fdc/utf8/,
|
||||||
# http://winrus.com/utf8-jap.htm and memory
|
# http://winrus.com/utf8-jap.htm and memory
|
||||||
UTF8_TEST_DOCSTRING = (
|
UTF8_TEST_DOCSTRING = (
|
||||||
|
|
|
@ -2,10 +2,11 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
from django.db import connection, connections, transaction
|
from django.db import connection, connections, transaction
|
||||||
from django.test import TestCase, TransactionTestCase
|
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
from django.test import TestCase, TransactionTestCase
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.utils.unittest import skipUnless
|
from django.utils.unittest import skipUnless
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.exceptions import APIException
|
from rest_framework.exceptions import APIException
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
@ -13,7 +14,6 @@ from rest_framework.test import APIRequestFactory
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from tests.models import BasicModel
|
from tests.models import BasicModel
|
||||||
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,26 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import url, include
|
|
||||||
|
import base64
|
||||||
|
|
||||||
|
from django.conf.urls import include, url
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from rest_framework import HTTP_HEADER_ENCODING
|
|
||||||
from rest_framework import exceptions
|
from rest_framework import (
|
||||||
from rest_framework import permissions
|
HTTP_HEADER_ENCODING, exceptions, permissions, renderers, status
|
||||||
from rest_framework import renderers
|
)
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework import status
|
|
||||||
from rest_framework.authentication import (
|
from rest_framework.authentication import (
|
||||||
BaseAuthentication,
|
BaseAuthentication, BasicAuthentication, SessionAuthentication,
|
||||||
TokenAuthentication,
|
TokenAuthentication
|
||||||
BasicAuthentication,
|
|
||||||
SessionAuthentication,
|
|
||||||
)
|
)
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
from rest_framework.test import APIRequestFactory, APIClient
|
from rest_framework.response import Response
|
||||||
|
from rest_framework.test import APIClient, APIRequestFactory
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
import base64
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.authentication import BasicAuthentication
|
from rest_framework.authentication import BasicAuthentication
|
||||||
|
from rest_framework.decorators import (
|
||||||
|
api_view, authentication_classes, parser_classes, permission_classes,
|
||||||
|
renderer_classes, throttle_classes
|
||||||
|
)
|
||||||
from rest_framework.parsers import JSONParser
|
from rest_framework.parsers import JSONParser
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework.renderers import JSONRenderer
|
from rest_framework.renderers import JSONRenderer
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from rest_framework.throttling import UserRateThrottle
|
from rest_framework.throttling import UserRateThrottle
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.decorators import (
|
|
||||||
api_view,
|
|
||||||
renderer_classes,
|
|
||||||
parser_classes,
|
|
||||||
authentication_classes,
|
|
||||||
throttle_classes,
|
|
||||||
permission_classes,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DecoratorTestCase(TestCase):
|
class DecoratorTestCase(TestCase):
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils.encoding import python_2_unicode_compatible, smart_text
|
from django.utils.encoding import python_2_unicode_compatible, smart_text
|
||||||
|
|
||||||
from rest_framework.compat import apply_markdown
|
from rest_framework.compat import apply_markdown
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from .description import ViewWithNonASCIICharactersInDocstring
|
|
||||||
from .description import UTF8_TEST_DOCSTRING
|
from .description import (
|
||||||
|
UTF8_TEST_DOCSTRING, ViewWithNonASCIICharactersInDocstring
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# We check that docstrings get nicely un-indented.
|
# We check that docstrings get nicely un-indented.
|
||||||
DESCRIPTION = """an example docstring
|
DESCRIPTION = """an example docstring
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
from decimal import Decimal
|
|
||||||
from django.utils import timezone
|
|
||||||
from rest_framework import serializers
|
|
||||||
import rest_framework
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import uuid
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
import django
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import uuid
|
from django.utils import timezone
|
||||||
|
|
||||||
|
import rest_framework
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
# Tests for field keyword arguments and core functionality.
|
# Tests for field keyword arguments and core functionality.
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from django.db import models
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.utils import unittest
|
from django.utils import unittest
|
||||||
from django.utils.dateparse import parse_date
|
from django.utils.dateparse import parse_date
|
||||||
from django.utils.six.moves import reload_module
|
from django.utils.six.moves import reload_module
|
||||||
from rest_framework import generics, serializers, status, filters
|
|
||||||
|
from rest_framework import filters, generics, serializers, status
|
||||||
from rest_framework.compat import django_filters
|
from rest_framework.compat import django_filters
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from .models import BaseFilterableItem, FilterableItem, BasicModel
|
|
||||||
|
|
||||||
|
from .models import BaseFilterableItem, BasicModel, FilterableItem
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework import generics, renderers, serializers, status
|
from rest_framework import generics, renderers, serializers, status
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from tests.models import BasicModel, RESTFrameworkModel
|
from tests.models import (
|
||||||
from tests.models import ForeignKeySource, ForeignKeyTarget
|
BasicModel, ForeignKeySource, ForeignKeyTarget, RESTFrameworkModel
|
||||||
|
)
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.core.exceptions import PermissionDenied
|
|
||||||
|
import django.template.loader
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
from django.template import Template, TemplateDoesNotExist
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.template import TemplateDoesNotExist, Template
|
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.decorators import api_view, renderer_classes
|
from rest_framework.decorators import api_view, renderer_classes
|
||||||
from rest_framework.renderers import TemplateHTMLRenderer
|
from rest_framework.renderers import TemplateHTMLRenderer
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
import django.template.loader
|
|
||||||
|
|
||||||
|
|
||||||
@api_view(('GET',))
|
@api_view(('GET',))
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
|
||||||
from rest_framework import exceptions, metadata, serializers, status, views, versioning
|
from rest_framework import (
|
||||||
from rest_framework.request import Request
|
exceptions, metadata, serializers, status, versioning, views
|
||||||
|
)
|
||||||
from rest_framework.renderers import BrowsableAPIRenderer
|
from rest_framework.renderers import BrowsableAPIRenderer
|
||||||
|
from rest_framework.request import Request
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
request = Request(APIRequestFactory().options('/'))
|
request = Request(APIRequestFactory().options('/'))
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from rest_framework.authentication import TokenAuthentication
|
from rest_framework.authentication import TokenAuthentication
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', APIView.as_view(authentication_classes=(TokenAuthentication,))),
|
url(r'^$', APIView.as_view(authentication_classes=(TokenAuthentication,))),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,15 +6,20 @@ These tests deal with ensuring that we correctly map the model fields onto
|
||||||
an appropriate set of serializer fields for each case.
|
an appropriate set of serializer fields for each case.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
import pytest
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.validators import MaxValueValidator, MinValueValidator, MinLengthValidator
|
from django.core.validators import (
|
||||||
|
MaxValueValidator, MinLengthValidator, MinValueValidator
|
||||||
|
)
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
import pytest
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.compat import unicode_repr, DurationField as ModelDurationField
|
from rest_framework.compat import DurationField as ModelDurationField
|
||||||
|
from rest_framework.compat import unicode_repr
|
||||||
|
|
||||||
|
|
||||||
def dedent(blocktext):
|
def dedent(blocktext):
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from tests.models import RESTFrameworkModel
|
from tests.models import RESTFrameworkModel
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.test import TestCase
|
|
||||||
from rest_framework.negotiation import DefaultContentNegotiation
|
|
||||||
from rest_framework.request import Request
|
|
||||||
from rest_framework.renderers import BaseRenderer
|
|
||||||
from rest_framework.test import APIRequestFactory
|
|
||||||
|
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from rest_framework.negotiation import DefaultContentNegotiation
|
||||||
|
from rest_framework.renderers import BaseRenderer
|
||||||
|
from rest_framework.request import Request
|
||||||
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from rest_framework import exceptions, generics, pagination, serializers, status, filters
|
|
||||||
from rest_framework.request import Request
|
|
||||||
from rest_framework.pagination import PageLink, PAGE_BREAK
|
|
||||||
from rest_framework.test import APIRequestFactory
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from rest_framework import (
|
||||||
|
exceptions, filters, generics, pagination, serializers, status
|
||||||
|
)
|
||||||
|
from rest_framework.pagination import PAGE_BREAK, PageLink
|
||||||
|
from rest_framework.request import Request
|
||||||
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.files.uploadhandler import MemoryFileUploadHandler
|
from django.core.files.uploadhandler import MemoryFileUploadHandler
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils.six.moves import StringIO
|
from django.utils.six.moves import StringIO
|
||||||
|
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
from rest_framework.parsers import FormParser, FileUploadParser
|
from rest_framework.parsers import FileUploadParser, FormParser
|
||||||
|
|
||||||
|
|
||||||
class Form(forms.Form):
|
class Form(forms.Form):
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.contrib.auth.models import User, Permission, Group
|
|
||||||
|
import base64
|
||||||
|
|
||||||
|
from django.contrib.auth.models import Group, Permission, User
|
||||||
|
from django.core.urlresolvers import ResolverMatch
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import unittest
|
from django.utils import unittest
|
||||||
from rest_framework import generics, serializers, status, permissions, authentication, HTTP_HEADER_ENCODING
|
|
||||||
from rest_framework.compat import guardian, get_model_name
|
from rest_framework import (
|
||||||
from django.core.urlresolvers import ResolverMatch
|
HTTP_HEADER_ENCODING, authentication, generics, permissions, serializers,
|
||||||
|
status
|
||||||
|
)
|
||||||
|
from rest_framework.compat import get_model_name, guardian
|
||||||
from rest_framework.filters import DjangoObjectPermissionsFilter
|
from rest_framework.filters import DjangoObjectPermissionsFilter
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from tests.models import BasicModel
|
from tests.models import BasicModel
|
||||||
import base64
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
import uuid
|
import uuid
|
||||||
from .utils import mock_reverse, fail_reverse, BadType, MockObject, MockQueryset
|
|
||||||
|
import pytest
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.fields import empty
|
from rest_framework.fields import empty
|
||||||
from rest_framework.test import APISimpleTestCase
|
from rest_framework.test import APISimpleTestCase
|
||||||
import pytest
|
|
||||||
|
from .utils import (
|
||||||
|
BadType, MockObject, MockQueryset, fail_reverse, mock_reverse
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestStringRelatedField(APISimpleTestCase):
|
class TestStringRelatedField(APISimpleTestCase):
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.contrib.contenttypes.generic import (
|
||||||
|
GenericForeignKey, GenericRelation
|
||||||
|
)
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.contenttypes.generic import GenericRelation, GenericForeignKey
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from tests.models import (
|
from tests.models import (
|
||||||
ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource,
|
ForeignKeySource, ForeignKeyTarget, ManyToManySource, ManyToManyTarget,
|
||||||
NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource
|
NullableForeignKeySource, NullableOneToOneSource, OneToOneTarget
|
||||||
)
|
)
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from tests.models import (
|
from tests.models import (
|
||||||
ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource,
|
ForeignKeySource, ForeignKeyTarget, ManyToManySource, ManyToManyTarget,
|
||||||
NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource,
|
NullableForeignKeySource, NullableOneToOneSource, OneToOneTarget
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from tests.models import NullableForeignKeySource, ForeignKeySource, ForeignKeyTarget
|
from tests.models import (
|
||||||
|
ForeignKeySource, ForeignKeyTarget, NullableForeignKeySource
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ForeignKeyTargetSerializer(serializers.ModelSerializer):
|
class ForeignKeyTargetSerializer(serializers.ModelSerializer):
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import url, include
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
from collections import MutableMapping
|
||||||
|
|
||||||
|
from django.conf.urls import include, url
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import status, permissions
|
|
||||||
|
from rest_framework import permissions, serializers, status
|
||||||
from rest_framework.compat import OrderedDict
|
from rest_framework.compat import OrderedDict
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework.views import APIView
|
|
||||||
from rest_framework import serializers
|
|
||||||
from rest_framework.renderers import (
|
from rest_framework.renderers import (
|
||||||
BaseRenderer, JSONRenderer, BrowsableAPIRenderer, HTMLFormRenderer
|
BaseRenderer, BrowsableAPIRenderer, HTMLFormRenderer, JSONRenderer
|
||||||
)
|
)
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from collections import MutableMapping
|
from rest_framework.views import APIView
|
||||||
import json
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
DUMMYSTATUS = status.HTTP_200_OK
|
DUMMYSTATUS = status.HTTP_200_OK
|
||||||
DUMMYCONTENT = 'dummycontent'
|
DUMMYCONTENT = 'dummycontent'
|
||||||
|
|
|
@ -2,31 +2,30 @@
|
||||||
Tests for content parsing, and form-overloaded content parsing.
|
Tests for content parsing, and form-overloaded content parsing.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
|
import django
|
||||||
|
import pytest
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.contrib.auth import authenticate, login, logout
|
from django.contrib.auth import authenticate, login, logout
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.sessions.middleware import SessionMiddleware
|
from django.contrib.sessions.middleware import SessionMiddleware
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
from rest_framework.parsers import (
|
from rest_framework.parsers import (
|
||||||
BaseParser,
|
BaseParser, FormParser, JSONParser, MultiPartParser
|
||||||
FormParser,
|
|
||||||
MultiPartParser,
|
|
||||||
JSONParser
|
|
||||||
)
|
)
|
||||||
from rest_framework.request import Request, Empty
|
from rest_framework.request import Empty, Request
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.test import APIRequestFactory, APIClient
|
from rest_framework.test import APIClient, APIRequestFactory
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from io import BytesIO
|
|
||||||
import json
|
|
||||||
import django
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import url, include
|
|
||||||
|
from django.conf.urls import include, url
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from tests.models import BasicModel
|
|
||||||
from rest_framework.response import Response
|
from rest_framework import generics, routers, serializers, status, viewsets
|
||||||
from rest_framework.views import APIView
|
|
||||||
from rest_framework import generics
|
|
||||||
from rest_framework import routers
|
|
||||||
from rest_framework import serializers
|
|
||||||
from rest_framework import status
|
|
||||||
from rest_framework.renderers import (
|
from rest_framework.renderers import (
|
||||||
BaseRenderer,
|
BaseRenderer, BrowsableAPIRenderer, JSONRenderer
|
||||||
JSONRenderer,
|
|
||||||
BrowsableAPIRenderer
|
|
||||||
)
|
)
|
||||||
from rest_framework import viewsets
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
from tests.models import BasicModel
|
||||||
|
|
||||||
|
|
||||||
# Serializer used to test BasicModel
|
# Serializer used to test BasicModel
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.core.urlresolvers import NoReverseMatch
|
from django.core.urlresolvers import NoReverseMatch
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework.reverse import reverse
|
from rest_framework.reverse import reverse
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import url, include
|
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from django.conf.urls import include, url
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
from rest_framework import serializers, viewsets, permissions
|
from rest_framework import permissions, serializers, viewsets
|
||||||
from rest_framework.decorators import detail_route, list_route
|
from rest_framework.decorators import detail_route, list_route
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.routers import SimpleRouter, DefaultRouter
|
from rest_framework.routers import DefaultRouter, SimpleRouter
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from .utils import MockObject
|
|
||||||
|
import pickle
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.compat import unicode_repr
|
from rest_framework.compat import unicode_repr
|
||||||
import pickle
|
|
||||||
import pytest
|
from .utils import MockObject
|
||||||
|
|
||||||
|
|
||||||
# Tests for core functionality.
|
# Tests for core functionality.
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
Tests to cover bulk create and update using serializers.
|
Tests to cover bulk create and update using serializers.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from rest_framework import serializers
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
class BasicObject:
|
class BasicObject:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework.settings import APISettings
|
from rest_framework.settings import APISettings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework.status import (
|
from rest_framework.status import (
|
||||||
is_informational, is_success, is_redirect, is_client_error, is_server_error
|
is_client_error, is_informational, is_redirect, is_server_error,
|
||||||
|
is_success
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.test import TestCase
|
|
||||||
from rest_framework.test import APIRequestFactory
|
|
||||||
from rest_framework.templatetags.rest_framework import add_query_param, urlize_quoted_links
|
|
||||||
|
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from rest_framework.templatetags.rest_framework import (
|
||||||
|
add_query_param, urlize_quoted_links
|
||||||
|
)
|
||||||
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework.decorators import api_view
|
from rest_framework.decorators import api_view
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.test import APIClient, APIRequestFactory, force_authenticate
|
from rest_framework.test import (
|
||||||
from io import BytesIO
|
APIClient, APIRequestFactory, force_authenticate
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@api_view(['GET', 'POST'])
|
@api_view(['GET', 'POST'])
|
||||||
|
|
|
@ -2,14 +2,18 @@
|
||||||
Tests for the throttling implementations in the permissions module.
|
Tests for the throttling implementations in the permissions module.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.test import TestCase
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
|
from rest_framework.throttling import (
|
||||||
|
BaseThrottle, ScopedRateThrottle, UserRateThrottle
|
||||||
|
)
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.throttling import BaseThrottle, UserRateThrottle, ScopedRateThrottle
|
|
||||||
from rest_framework.response import Response
|
|
||||||
|
|
||||||
|
|
||||||
class User3SecRateThrottle(UserRateThrottle):
|
class User3SecRateThrottle(UserRateThrottle):
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from django.conf.urls import url, include
|
|
||||||
|
from django.conf.urls import include, url
|
||||||
from django.core import urlresolvers
|
from django.core import urlresolvers
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from rest_framework.urlpatterns import format_suffix_patterns
|
from rest_framework.urlpatterns import format_suffix_patterns
|
||||||
|
|
||||||
|
|
||||||
# A container class for test paths for the test case
|
# A container class for test paths for the test case
|
||||||
URLTestPath = namedtuple('URLTestPath', ['path', 'args', 'kwargs'])
|
URLTestPath = namedtuple('URLTestPath', ['path', 'args', 'kwargs'])
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from rest_framework.utils.model_meta import _resolve_model
|
|
||||||
from rest_framework.utils.breadcrumbs import get_breadcrumbs
|
|
||||||
from rest_framework.views import APIView
|
|
||||||
from tests.models import BasicModel
|
|
||||||
|
|
||||||
import rest_framework.utils.model_meta
|
import rest_framework.utils.model_meta
|
||||||
|
from rest_framework.utils.breadcrumbs import get_breadcrumbs
|
||||||
|
from rest_framework.utils.model_meta import _resolve_model
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
from tests.models import BasicModel
|
||||||
|
|
||||||
|
|
||||||
class Root(APIView):
|
class Root(APIView):
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.core.validators import RegexValidator, MaxValueValidator
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from django.core.validators import MaxValueValidator, RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import generics, serializers, status
|
from rest_framework import generics, serializers, status
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
import re
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
import datetime
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
import datetime
|
|
||||||
|
|
||||||
|
|
||||||
def dedent(blocktext):
|
def dedent(blocktext):
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
from .utils import UsingURLPatterns
|
import pytest
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
from rest_framework import serializers
|
|
||||||
from rest_framework import status, versioning
|
from rest_framework import serializers, status, versioning
|
||||||
from rest_framework.decorators import APIView
|
from rest_framework.decorators import APIView
|
||||||
|
from rest_framework.relations import PKOnlyObject
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.reverse import reverse
|
from rest_framework.reverse import reverse
|
||||||
from rest_framework.test import APIRequestFactory, APITestCase
|
from rest_framework.test import APIRequestFactory, APITestCase
|
||||||
from rest_framework.versioning import NamespaceVersioning
|
from rest_framework.versioning import NamespaceVersioning
|
||||||
from rest_framework.relations import PKOnlyObject
|
|
||||||
import pytest
|
from .utils import UsingURLPatterns
|
||||||
|
|
||||||
|
|
||||||
class RequestVersionView(APIView):
|
class RequestVersionView(APIView):
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import sys
|
|
||||||
import copy
|
import copy
|
||||||
|
import sys
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.decorators import api_view
|
from rest_framework.decorators import api_view
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.test import APIRequestFactory
|
from rest_framework.test import APIRequestFactory
|
||||||
from rest_framework.viewsets import GenericViewSet
|
from rest_framework.viewsets import GenericViewSet
|
||||||
|
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user