mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Merge pull request #3199 from tomchristie/remove-url-from-future
Remove 'load url from future' tags in templates.
This commit is contained in:
commit
aa3f844b3d
|
@ -23,8 +23,6 @@ env:
|
|||
- TOX_ENV=py32-django15
|
||||
- TOX_ENV=py27-django15
|
||||
- TOX_ENV=py26-django15
|
||||
- TOX_ENV=py27-django14
|
||||
- TOX_ENV=py26-django14
|
||||
- TOX_ENV=py27-djangomaster
|
||||
- TOX_ENV=py32-djangomaster
|
||||
- TOX_ENV=py33-djangomaster
|
||||
|
|
|
@ -36,7 +36,7 @@ There is a live example API for testing purposes, [available here][sandbox].
|
|||
# Requirements
|
||||
|
||||
* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4)
|
||||
* Django (1.4.11+, 1.5.6+, 1.6.3+, 1.7, 1.8)
|
||||
* Django (1.5.6+, 1.6.3+, 1.7, 1.8)
|
||||
|
||||
# Installation
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ Some reasons you might want to use REST framework:
|
|||
REST framework requires the following:
|
||||
|
||||
* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4)
|
||||
* Django (1.4.11+, 1.5.6+, 1.6.3+, 1.7+, 1.8)
|
||||
* Django (1.5.6+, 1.6.3+, 1.7+, 1.8)
|
||||
|
||||
The following packages are optional:
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ Quit out of the shell...
|
|||
Validating models...
|
||||
|
||||
0 errors found
|
||||
Django version 1.4.3, using settings 'tutorial.settings'
|
||||
Django version 1.8.3, using settings 'tutorial.settings'
|
||||
Development server is running at http://127.0.0.1:8000/
|
||||
Quit the server with CONTROL-C.
|
||||
|
||||
|
|
|
@ -203,41 +203,6 @@ if 'patch' not in View.http_method_names:
|
|||
View.http_method_names = View.http_method_names + ['patch']
|
||||
|
||||
|
||||
|
||||
try:
|
||||
# In 1.5 the test client uses force_bytes
|
||||
from django.utils.encoding import force_bytes as force_bytes_or_smart_bytes
|
||||
except ImportError:
|
||||
# In 1.4 the test client just uses smart_str
|
||||
from django.utils.encoding import smart_str as force_bytes_or_smart_bytes
|
||||
|
||||
|
||||
# RequestFactory only provides `generic` from 1.5 onwards
|
||||
if django.VERSION >= (1, 5):
|
||||
from django.test.client import RequestFactory
|
||||
else:
|
||||
from django.test.client import RequestFactory as DjangoRequestFactory
|
||||
|
||||
class RequestFactory(DjangoRequestFactory):
|
||||
def generic(self, method, path,
|
||||
data='', content_type='application/octet-stream', **extra):
|
||||
parsed = _urlparse(path)
|
||||
data = force_bytes_or_smart_bytes(data, settings.DEFAULT_CHARSET)
|
||||
r = {
|
||||
'PATH_INFO': self._get_path(parsed),
|
||||
'QUERY_STRING': force_text(parsed[4]),
|
||||
'REQUEST_METHOD': six.text_type(method),
|
||||
}
|
||||
if data:
|
||||
r.update({
|
||||
'CONTENT_LENGTH': len(data),
|
||||
'CONTENT_TYPE': six.text_type(content_type),
|
||||
'wsgi.input': FakePayload(data),
|
||||
})
|
||||
r.update(extra)
|
||||
return self.request(**r)
|
||||
|
||||
|
||||
# Markdown is optional
|
||||
try:
|
||||
import markdown
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{% load url from future %}
|
||||
{% load staticfiles %}
|
||||
{% load rest_framework %}
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{% load url from future %}
|
||||
{% load staticfiles %}
|
||||
{% load rest_framework %}
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% extends "rest_framework/base.html" %}
|
||||
{% load url from future %}
|
||||
{% load staticfiles %}
|
||||
{% load rest_framework %}
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ import django
|
|||
from django.conf import settings
|
||||
from django.test import testcases
|
||||
from django.test.client import Client as DjangoClient
|
||||
from django.test.client import RequestFactory as DjangoRequestFactory
|
||||
from django.test.client import ClientHandler
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlencode
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ class APIRequestFactory(DjangoRequestFactory):
|
|||
|
||||
if content_type:
|
||||
# Content type specified explicitly, treat data as a raw bytestring
|
||||
ret = force_bytes_or_smart_bytes(data, settings.DEFAULT_CHARSET)
|
||||
ret = force_bytes(data, settings.DEFAULT_CHARSET)
|
||||
|
||||
else:
|
||||
format = format or self.default_format
|
||||
|
|
1
tox.ini
1
tox.ini
|
@ -13,7 +13,6 @@ commands = ./runtests.py --fast {posargs}
|
|||
setenv =
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
deps =
|
||||
django14: Django==1.4.11 # Should track minimum supported
|
||||
django15: Django==1.5.6 # Should track minimum supported
|
||||
django16: Django==1.6.3 # Should track minimum supported
|
||||
django17: Django==1.7.8 # Should track maximum supported
|
||||
|
|
Loading…
Reference in New Issue
Block a user