renamed djangorestframework to djangorestframework-3

This commit is contained in:
David Quinn 2015-04-29 16:57:29 -04:00
parent 2eb9107b87
commit 72a7020d40
211 changed files with 306 additions and 306 deletions

View File

@ -1,9 +1,9 @@
[main]
host = https://www.transifex.com
[django-rest-framework.djangopo]
file_filter = rest_framework/locale/<lang>/LC_MESSAGES/django.po
source_file = rest_framework/locale/en_US/LC_MESSAGES/django.po
[django-rest-framework-3.djangopo]
file_filter = rest_framework_3/locale/<lang>/LC_MESSAGES/django.po
source_file = rest_framework_3/locale/en_US/LC_MESSAGES/django.po
source_lang = en_US
type = PO

View File

@ -1,4 +1,4 @@
recursive-include rest_framework/static *.js *.css *.png *.eot *.svg *.ttf *.woff
recursive-include rest_framework/templates *.html
recursive-include rest_framework_3/static *.js *.css *.png *.eot *.svg *.ttf *.woff
recursive-include rest_framework_3/templates *.html
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

View File

@ -44,11 +44,11 @@ Install using `pip`...
pip install djangorestframework
Add `'rest_framework'` to your `INSTALLED_APPS` setting.
Add `'rest_framework_3'` to your `INSTALLED_APPS` setting.
INSTALLED_APPS = (
...
'rest_framework',
'rest_framework_3',
)
# Example
@ -67,7 +67,7 @@ Now edit the `example/urls.py` module in your project:
```python
from django.conf.urls import url, include
from django.contrib.auth.models import User
from rest_framework import serializers, viewsets, routers
from rest_framework_3 import serializers, viewsets, routers
# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
@ -91,7 +91,7 @@ router.register(r'users', UserViewSet)
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
url(r'^api-auth/', include('rest_framework_3.urls', namespace='rest_framework_3'))
]
```
@ -102,14 +102,14 @@ Add the following to your `settings.py` module:
```python
INSTALLED_APPS = (
... # Make sure to include the default installed apps here.
'rest_framework',
'rest_framework_3',
)
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
'rest_framework_3.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
```

View File

@ -6,8 +6,8 @@ import base64
from django.contrib.auth import authenticate
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.translation import ugettext_lazy as _
from rest_framework import exceptions, HTTP_HEADER_ENCODING
from rest_framework.authtoken.models import Token
from rest_framework_3 import exceptions, HTTP_HEADER_ENCODING
from rest_framework_3.authtoken.models import Token
def get_authorization_header(request):

View File

@ -1,5 +1,5 @@
from django.contrib import admin
from rest_framework.authtoken.models import Token
from rest_framework_3.authtoken.models import Token
class TokenAdmin(admin.ModelAdmin):

View File

@ -28,7 +28,7 @@ class Token(models.Model):
#
# Also see corresponding ticket:
# https://github.com/tomchristie/django-rest-framework/issues/705
abstract = 'rest_framework.authtoken' not in settings.INSTALLED_APPS
abstract = 'rest_framework_3.authtoken' not in settings.INSTALLED_APPS
def save(self, *args, **kwargs):
if not self.key:

View File

@ -1,7 +1,7 @@
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import exceptions, serializers
from rest_framework_3 import exceptions, serializers
class AuthTokenSerializer(serializers.Serializer):

View File

@ -1,9 +1,9 @@
from rest_framework.views import APIView
from rest_framework import parsers
from rest_framework import renderers
from rest_framework.response import Response
from rest_framework.authtoken.models import Token
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework_3.views import APIView
from rest_framework_3 import parsers
from rest_framework_3 import renderers
from rest_framework_3.response import Response
from rest_framework_3.authtoken.models import Token
from rest_framework_3.authtoken.serializers import AuthTokenSerializer
class ObtainAuthToken(APIView):

View File

@ -8,7 +8,7 @@ used to annotate methods on viewsets that should be included by routers.
"""
from __future__ import unicode_literals
from django.utils import six
from rest_framework.views import APIView
from rest_framework_3.views import APIView
import types

View File

@ -8,7 +8,7 @@ from __future__ import unicode_literals
from django.utils import six
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _, ungettext
from rest_framework import status
from rest_framework_3 import status
import math
@ -51,7 +51,7 @@ class APIException(Exception):
# under `serializers`, in order to minimize potential confusion with Django's
# built in `ValidationError`. For example:
#
# from rest_framework import serializers
# from rest_framework_3 import serializers
# raise serializers.ValidationError('Value was invalid')
class ValidationError(APIException):

View File

@ -8,15 +8,15 @@ 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.translation import ugettext_lazy as _
from rest_framework import ISO_8601
from rest_framework.compat import (
from rest_framework_3 import ISO_8601
from rest_framework_3.compat import (
EmailValidator, MinValueValidator, MaxValueValidator,
MinLengthValidator, MaxLengthValidator, URLValidator, OrderedDict,
unicode_repr, unicode_to_repr
)
from rest_framework.exceptions import ValidationError
from rest_framework.settings import api_settings
from rest_framework.utils import html, representation, humanize_datetime
from rest_framework_3.exceptions import ValidationError
from rest_framework_3.settings import api_settings
from rest_framework_3.utils import html, representation, humanize_datetime
import collections
import copy
import datetime

View File

@ -7,8 +7,8 @@ from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils import six
from rest_framework.compat import django_filters, guardian, get_model_name
from rest_framework.settings import api_settings
from rest_framework_3.compat import django_filters, guardian, get_model_name
from rest_framework_3.settings import api_settings
from functools import reduce
import operator

View File

@ -5,8 +5,8 @@ from __future__ import unicode_literals
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 rest_framework import views, mixins
from rest_framework.settings import api_settings
from rest_framework_3 import views, mixins
from rest_framework_3.settings import api_settings
def get_object_or_404(queryset, *filter_args, **filter_kwargs):

View File

@ -11,10 +11,10 @@ from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.utils.encoding import force_text
from rest_framework import exceptions, serializers
from rest_framework.compat import OrderedDict
from rest_framework.request import clone_request
from rest_framework.utils.field_mapping import ClassLookupDict
from rest_framework_3 import exceptions, serializers
from rest_framework_3.compat import OrderedDict
from rest_framework_3.request import clone_request
from rest_framework_3.utils.field_mapping import ClassLookupDict
class BaseMetadata(object):

View File

@ -5,9 +5,9 @@ We don't bind behaviour to http method handlers yet,
which allows mixin classes to be composed in interesting ways.
"""
from __future__ import unicode_literals
from rest_framework import status
from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework_3 import status
from rest_framework_3.response import Response
from rest_framework_3.settings import api_settings
class CreateModelMixin(object):

View File

@ -4,10 +4,10 @@ incoming request. Typically this will be based on the request's Accept header.
"""
from __future__ import unicode_literals
from django.http import Http404
from rest_framework import HTTP_HEADER_ENCODING, exceptions
from rest_framework.settings import api_settings
from rest_framework.utils.mediatypes import order_by_precedence, media_type_matches
from rest_framework.utils.mediatypes import _MediaType
from rest_framework_3 import HTTP_HEADER_ENCODING, exceptions
from rest_framework_3.settings import api_settings
from rest_framework_3.utils.mediatypes import order_by_precedence, media_type_matches
from rest_framework_3.utils.mediatypes import _MediaType
class BaseContentNegotiation(object):

View File

@ -11,11 +11,11 @@ from django.template import Context, loader
from django.utils import six
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.translation import ugettext_lazy as _
from rest_framework.compat import OrderedDict
from rest_framework.exceptions import NotFound
from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework.utils.urls import (
from rest_framework_3.compat import OrderedDict
from rest_framework_3.exceptions import NotFound
from rest_framework_3.response import Response
from rest_framework_3.settings import api_settings
from rest_framework_3.utils.urls import (
replace_query_param, remove_query_param
)
import warnings

View File

@ -14,8 +14,8 @@ from django.http.multipartparser import MultiPartParserError, parse_header, Chun
from django.utils import six
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.encoding import force_text
from rest_framework.exceptions import ParseError
from rest_framework import renderers
from rest_framework_3.exceptions import ParseError
from rest_framework_3 import renderers
import json

View File

@ -3,7 +3,7 @@ Provides a set of pluggable permission policies.
"""
from __future__ import unicode_literals
from django.http import Http404
from rest_framework.compat import get_model_name
from rest_framework_3.compat import get_model_name
SAFE_METHODS = ('GET', 'HEAD', 'OPTIONS')

View File

@ -7,10 +7,10 @@ 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.compat import OrderedDict
from rest_framework.fields import get_attribute, empty, Field
from rest_framework.reverse import reverse
from rest_framework.utils import html
from rest_framework_3.compat import OrderedDict
from rest_framework_3.fields import get_attribute, empty, Field
from rest_framework_3.reverse import reverse
from rest_framework_3.utils import html
class PKOnlyObject(object):

View File

@ -17,14 +17,14 @@ from django.http.multipartparser import parse_header
from django.template import Context, RequestContext, loader, Template
from django.test.client import encode_multipart
from django.utils import six
from rest_framework import exceptions, serializers, status, VERSION
from rest_framework.compat import SHORT_SEPARATORS, LONG_SEPARATORS, INDENT_SEPARATORS
from rest_framework.exceptions import ParseError
from rest_framework.settings import api_settings
from rest_framework.request import is_form_media_type, override_method
from rest_framework.utils import encoders
from rest_framework.utils.breadcrumbs import get_breadcrumbs
from rest_framework.utils.field_mapping import ClassLookupDict
from rest_framework_3 import exceptions, serializers, status, VERSION
from rest_framework_3.compat import SHORT_SEPARATORS, LONG_SEPARATORS, INDENT_SEPARATORS
from rest_framework_3.exceptions import ParseError
from rest_framework_3.settings import api_settings
from rest_framework_3.request import is_form_media_type, override_method
from rest_framework_3.utils import encoders
from rest_framework_3.utils.breadcrumbs import get_breadcrumbs
from rest_framework_3.utils.field_mapping import ClassLookupDict
def zero_as_none(value):

View File

@ -14,9 +14,9 @@ from django.http import QueryDict
from django.http.multipartparser import parse_header
from django.utils import six
from django.utils.datastructures import MultiValueDict
from rest_framework import HTTP_HEADER_ENCODING
from rest_framework import exceptions
from rest_framework.settings import api_settings
from rest_framework_3 import HTTP_HEADER_ENCODING
from rest_framework_3 import exceptions
from rest_framework_3.settings import api_settings
import sys
import warnings

View File

@ -20,11 +20,11 @@ from collections import namedtuple
from django.conf.urls import patterns, url
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import NoReverseMatch
from rest_framework import views
from rest_framework.compat import get_resolver_match, OrderedDict
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework_3 import views
from rest_framework_3.compat import get_resolver_match, OrderedDict
from rest_framework_3.response import Response
from rest_framework_3.reverse import reverse
from rest_framework_3.urlpatterns import format_suffix_patterns
Route = namedtuple('Route', ['url', 'mapping', 'name', 'initkwargs'])

View File

@ -15,17 +15,17 @@ from django.db import models
from django.db.models.fields import FieldDoesNotExist, Field as DjangoModelField
from django.db.models import query
from django.utils.translation import ugettext_lazy as _
from rest_framework.compat import postgres_fields, unicode_to_repr
from rest_framework.utils import model_meta
from rest_framework.utils.field_mapping import (
from rest_framework_3.compat import postgres_fields, unicode_to_repr
from rest_framework_3.utils import model_meta
from rest_framework_3.utils.field_mapping import (
get_url_kwargs, get_field_kwargs,
get_relation_kwargs, get_nested_relation_kwargs,
ClassLookupDict
)
from rest_framework.utils.serializer_helpers import (
from rest_framework_3.utils.serializer_helpers import (
ReturnDict, ReturnList, BoundField, NestedBoundField, BindingDict
)
from rest_framework.validators import (
from rest_framework_3.validators import (
UniqueForDateValidator, UniqueForMonthValidator, UniqueForYearValidator,
UniqueTogetherValidator
)
@ -39,8 +39,8 @@ import warnings
# This helps keep the separation between model fields, form fields, and
# serializer fields more explicit.
from rest_framework.relations import * # NOQA
from rest_framework.fields import * # NOQA
from rest_framework_3.relations import * # NOQA
from rest_framework_3.fields import * # NOQA
# We assume that 'validators' are intended for the child serializer,

View File

@ -4,12 +4,12 @@ For example your project's `settings.py` file might look like this:
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.TemplateHTMLRenderer',
'rest_framework_3.renderers.JSONRenderer',
'rest_framework_3.renderers.TemplateHTMLRenderer',
)
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
'rest_framework.parsers.TemplateHTMLRenderer',
'rest_framework_3.parsers.JSONParser',
'rest_framework_3.parsers.TemplateHTMLRenderer',
)
}
@ -21,36 +21,36 @@ from __future__ import unicode_literals
from django.test.signals import setting_changed
from django.conf import settings
from django.utils import six
from rest_framework import ISO_8601
from rest_framework.compat import importlib
from rest_framework_3 import ISO_8601
from rest_framework_3.compat import importlib
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None)
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_3', None)
DEFAULTS = {
# Base API policies
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.BrowsableAPIRenderer',
'rest_framework_3.renderers.JSONRenderer',
'rest_framework_3.renderers.BrowsableAPIRenderer',
),
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
'rest_framework.parsers.FormParser',
'rest_framework.parsers.MultiPartParser'
'rest_framework_3.parsers.JSONParser',
'rest_framework_3.parsers.FormParser',
'rest_framework_3.parsers.MultiPartParser'
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication'
'rest_framework_3.authentication.SessionAuthentication',
'rest_framework_3.authentication.BasicAuthentication'
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.AllowAny',
'rest_framework_3.permissions.AllowAny',
),
'DEFAULT_THROTTLE_CLASSES': (),
'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'rest_framework.negotiation.DefaultContentNegotiation',
'DEFAULT_METADATA_CLASS': 'rest_framework.metadata.SimpleMetadata',
'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'rest_framework_3.negotiation.DefaultContentNegotiation',
'DEFAULT_METADATA_CLASS': 'rest_framework_3.metadata.SimpleMetadata',
'DEFAULT_VERSIONING_CLASS': None,
# Generic view behavior
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'DEFAULT_PAGINATION_CLASS': 'rest_framework_3.pagination.PageNumberPagination',
'DEFAULT_FILTER_BACKENDS': (),
# Throttling
@ -77,17 +77,17 @@ DEFAULTS = {
'UNAUTHENTICATED_TOKEN': None,
# View configuration
'VIEW_NAME_FUNCTION': 'rest_framework.views.get_view_name',
'VIEW_DESCRIPTION_FUNCTION': 'rest_framework.views.get_view_description',
'VIEW_NAME_FUNCTION': 'rest_framework_3.views.get_view_name',
'VIEW_DESCRIPTION_FUNCTION': 'rest_framework_3.views.get_view_description',
# Exception handling
'EXCEPTION_HANDLER': 'rest_framework.views.exception_handler',
'EXCEPTION_HANDLER': 'rest_framework_3.views.exception_handler',
'NON_FIELD_ERRORS_KEY': 'non_field_errors',
# Testing
'TEST_REQUEST_RENDERER_CLASSES': (
'rest_framework.renderers.MultiPartRenderer',
'rest_framework.renderers.JSONRenderer'
'rest_framework_3.renderers.MultiPartRenderer',
'rest_framework_3.renderers.JSONRenderer'
),
'TEST_REQUEST_DEFAULT_FORMAT': 'multipart',
@ -179,7 +179,7 @@ class APISettings(object):
A settings object, that allows API settings to be accessed as properties.
For example:
from rest_framework.settings import api_settings
from rest_framework_3.settings import api_settings
print(api_settings.DEFAULT_RENDERER_CLASSES)
Any setting with string import paths will be automatically resolved
@ -216,7 +216,7 @@ api_settings = APISettings(USER_SETTINGS, DEFAULTS, IMPORT_STRINGS)
def reload_api_settings(*args, **kwargs):
global api_settings
setting, value = kwargs['setting'], kwargs['value']
if setting == 'REST_FRAMEWORK':
if setting == 'REST_FRAMEWORK_3':
api_settings = APISettings(value, DEFAULTS, IMPORT_STRINGS)

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Some files were not shown because too many files have changed in this diff Show More