django 1.11 support (fixes #21116)

This commit is contained in:
Benjamin Dauvergne 2018-01-11 15:37:04 +01:00
parent d04235f7a4
commit 963582bfcf
5 changed files with 30 additions and 10 deletions

View File

@ -66,7 +66,7 @@ class PetalAuthentication(BasicAuthentication):
return True, None
def authenticate_credentials(self, userid, password):
def authenticate_credentials(self, userid, password, request=None):
username = userid[:30]
try:
user, auth = super(PetalAuthentication, self).authenticate_credentials(username,

View File

@ -78,6 +78,26 @@ USE_L10N = True
USE_TZ = True
# Templates
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
},
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

View File

@ -14,18 +14,17 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.contrib import admin
from .api_views import PetalAPIView, PetalAPIKeysView
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^api/(?P<partner_name>[\w,-]+)/(?P<cut_uuid>[\w,-]{,255})/$',
PetalAPIKeysView.as_view(),
name='api-keys'),
url(r'^api/(?P<partner_name>[\w,-]+)/(?P<cut_uuid>[\w,-]{,255})/(?P<petal_name>[\w,-]+)/$',
PetalAPIView.as_view(), name='api')
)
]

View File

@ -111,9 +111,9 @@ setup(
'Programming Language :: Python :: 2',
],
install_requires=[
'django>=1.8, <1.9',
'django>=1.8',
'django-jsonfield',
'djangorestframework<3.4',
'djangorestframework>=3.3',
'requests',
],
zip_safe=False,

View File

@ -1,5 +1,5 @@
[tox]
envlist = coverage-django18-pylint,coverage-django18
envlist = coverage-dj18-pylint,coverage-dj18,dj111
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/petale/
[testenv]
@ -10,7 +10,8 @@ setenv =
PETALE_SETTINGS_FILE=tests/settings.py
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=petale/ --cov-config .coveragerc
deps =
django18: django>=1.8,<1.9
dj18: django>=1.8,<1.9
dj111: django>=1.11,<1.12
pytest-cov
pytest-django
pytest
@ -18,7 +19,7 @@ deps =
pylint-django
mock
django-webtest
djangorestframework>=3.3,<3.4
dj18: djangorestframework<3.4
psycopg2
commands =
py.test {env:COVERAGE:} {posargs:tests/}