2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-19 09:22:32 +00:00

tidy render() calls

This commit is contained in:
Philip Sargent 2021-03-28 03:48:24 +01:00
parent a4c892b696
commit a99020078c
5 changed files with 8 additions and 11 deletions

View File

@ -6,7 +6,7 @@ import django.db.models
from django.db.models import Min, Max
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.shortcuts import render
from django.template import Context, loader
from django.template.defaultfilters import slugify
from django.utils import timezone
@ -31,6 +31,7 @@ import troggle.settings as settings
# to each template. So we use a custom method, render_response
# instead of render_to_response. Hopefully future Django releases
# will make this unnecessary.
# from troggle.alwaysUseRequestContext import render_response
# Deprecated in 1.11.29

View File

@ -6,7 +6,7 @@ import django.db.models
from django.db.models import Min, Max
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.shortcuts import render
from django.template import Context, loader
from django.template.defaultfilters import slugify
from django.utils import timezone
@ -31,6 +31,7 @@ import troggle.settings as settings
# to each template. So we use a custom method, render_response
# instead of render_to_response. Hopefully future Django releases
# will make this unnecessary.
# from troggle.alwaysUseRequestContext import render_response
# Deprecated in 1.11.29

View File

@ -29,7 +29,7 @@ def troggle404(request): # cannot get this to work. Handler404 in urls.py not ri
'''
context = RequestContext(request)
#context['caves'] = Cave.objects.all()
return render_to_response('404.html', context.flatten())
return render(request, ('404.html', context.flatten()))
def showrequest(request):
return HttpResponse(request.GET)

View File

@ -5,7 +5,7 @@ from collections import OrderedDict
import django.db.models
from django.db.models import Min, Max
from django.shortcuts import render, render_to_response
from django.shortcuts import render
from django.template import Context, loader
from django.template.defaultfilters import slugify
from django.utils import timezone

View File

@ -5,12 +5,9 @@ import difflib
from pathlib import Path
from django import forms
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response, render
#from django.core.context_processors import csrf
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render
from django.template.context_processors import csrf
from django.http import HttpResponse, Http404
from django.views.decorators.csrf import ensure_csrf_cookie
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
@ -382,8 +379,6 @@ def survexcavesingle(request, survex_cave):
kataster numbers are not unique across areas. Fix this.
'''
sc = survex_cave
context = RequestContext(request)
context_dict = {}
try:
cave = Cave.objects.get(kataster_number=sc) # This may not be unique.
return render(request, 'svxcavesingle.html', {'settings': settings, "cave":cave })