mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Update to Django 1.10
This commit is contained in:
@@ -26,15 +26,15 @@ def user_passes_test_with_403(test_func, login_url=None, oembed_view=None):
|
|||||||
return view_func(request, *args, **kwargs)
|
return view_func(request, *args, **kwargs)
|
||||||
elif not request.user.is_authenticated():
|
elif not request.user.is_authenticated():
|
||||||
if oembed_view is not None:
|
if oembed_view is not None:
|
||||||
extra_context = {}
|
context = RequestContext(request)
|
||||||
extra_context['oembed_url'] = "{0}://{1}{2}".format(request.scheme, request.META['HTTP_HOST'], reverse(oembed_view, kwargs=kwargs))
|
context['oembed_url'] = "{0}://{1}{2}".format(request.scheme, request.META['HTTP_HOST'], reverse(oembed_view, kwargs=kwargs))
|
||||||
extra_context['login_url'] = "{0}?{1}={2}".format(login_url, REDIRECT_FIELD_NAME, request.get_full_path())
|
context['login_url'] = "{0}?{1}={2}".format(login_url, REDIRECT_FIELD_NAME, request.get_full_path())
|
||||||
resp = render_to_response('login_redirect.html', extra_context, context_instance=RequestContext(request))
|
resp = render_to_response('login_redirect.html', context=context)
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, request.get_full_path()))
|
return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, request.get_full_path()))
|
||||||
else:
|
else:
|
||||||
resp = render_to_response('403.html', context_instance=RequestContext(request))
|
resp = render_to_response('403.html', context=RequestContext(request))
|
||||||
resp.status_code = 403
|
resp.status_code = 403
|
||||||
return resp
|
return resp
|
||||||
_checklogin.__doc__ = view_func.__doc__
|
_checklogin.__doc__ = view_func.__doc__
|
||||||
@@ -62,7 +62,7 @@ def api_key_required(function):
|
|||||||
userid = kwargs.get('api_pk')
|
userid = kwargs.get('api_pk')
|
||||||
key = kwargs.get('api_key')
|
key = kwargs.get('api_key')
|
||||||
|
|
||||||
error_resp = render_to_response('403.html', context_instance=RequestContext(request))
|
error_resp = render_to_response('403.html', context=RequestContext(request))
|
||||||
error_resp.status_code = 403
|
error_resp.status_code = 403
|
||||||
|
|
||||||
if key is None:
|
if key is None:
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ ALLOWED_HOSTS = ['pyrigs.nottinghamtec.co.uk', 'rigs.nottinghamtec.co.uk', 'pyri
|
|||||||
if STAGING:
|
if STAGING:
|
||||||
ALLOWED_HOSTS.append('.herokuapp.com')
|
ALLOWED_HOSTS.append('.herokuapp.com')
|
||||||
|
|
||||||
|
if DEBUG:
|
||||||
|
ALLOWED_HOSTS.append('localhost')
|
||||||
|
|
||||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
SECURE_SSL_REDIRECT = True # Redirect all http requests to https
|
SECURE_SSL_REDIRECT = True # Redirect all http requests to https
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from django.conf.urls import patterns, include, url
|
from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from django.conf.urls import patterns, include, url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth.views import password_reset
|
from django.contrib.auth.views import password_reset
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
beautifulsoup4==4.4.1
|
beautifulsoup4==4.4.1
|
||||||
|
contextlib2==0.5.5
|
||||||
diff-match-patch==20121119
|
diff-match-patch==20121119
|
||||||
dj-database-url==0.4.0
|
dj-database-url==0.4.0
|
||||||
dj-static==0.0.6
|
dj-static==0.0.6
|
||||||
Django==1.9.4
|
Django==1.10.7
|
||||||
django-debug-toolbar==1.4
|
django-debug-toolbar==1.4
|
||||||
django-ical==1.3
|
django-ical==1.3
|
||||||
django-recaptcha==1.0.5
|
django-recaptcha==1.0.5
|
||||||
|
|||||||
Reference in New Issue
Block a user