Skip to content
Snippets Groups Projects
Commit fb434252 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[attestations][views] Moved from render_to_response to render

render_to_response is deprecated in Django 2.0 and render has
been available since 1.3. It's shorter to write and avoids the
writing of context_instance=RequestContext(request) in each of
its call.
parent 1e3900e7
No related branches found
No related tags found
2 merge requests!2551.4.x,!238Upgrade to django 1.11
......@@ -31,8 +31,7 @@
from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.shortcuts import render
from django.contrib.auth.models import User
from django.db.models import Q
......@@ -46,13 +45,13 @@ def view(request, number):
(has_access, _) = attestation.experiment.accessibility_for(request.user)
# Render the page
return render_to_response('attestations/view.html',
dict(
attestation=attestation,
has_access=has_access,
owner=(attestation.experiment.author == request.user),
),
context_instance=RequestContext(request))
return render(request,
'attestations/view.html',
dict(
attestation=attestation,
has_access=has_access,
owner=(attestation.experiment.author == request.user)
))
def ls(request, author_name):
......@@ -75,14 +74,13 @@ def ls(request, author_name):
objects = objects.order_by('-locked', 'expiration_date')
return render_to_response('attestations/list.html',
dict(
objects=objects,
author=author,
owner=(request.user==author),
),
context_instance=RequestContext(request),
)
return render(request,
'attestations/list.html',
dict(
objects=objects,
author=author,
owner=(request.user == author)
))
def public_ls(request):
......@@ -91,11 +89,10 @@ def public_ls(request):
# orders so that recent objects are displayed first
objects = Attestation.objects.filter(locked=False).order_by('-publication_date')
return render_to_response('attestations/list.html',
dict(
objects=objects,
author=request.user, #anonymous
owner=False,
),
context_instance=RequestContext(request),
)
return render(request,
'attestations/list.html',
dict(
objects=objects,
author=request.user, # anonymous
owner=False,
))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment