From a44d8f7b01750a2fb68659242360e507fec0cd1d Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Fri, 7 Jul 2017 02:29:20 -0700 Subject: [PATCH] confirmation/views: Restructure code for clarity. --- confirmation/views.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/confirmation/views.py b/confirmation/views.py index 6b7d1e0f55..0a50ae69d4 100644 --- a/confirmation/views.py +++ b/confirmation/views.py @@ -20,14 +20,10 @@ from typing import Any, Dict def confirm(request, confirmation_key): # type: (HttpRequest, str) -> HttpResponse obj = Confirmation.objects.confirm(confirmation_key) - ctx = {'confirmed': False} # type: Dict[str, Any] - templates = [ - 'confirmation/confirm.html', - ] if obj: - ctx = { - 'key': confirmation_key, - 'full_name': request.GET.get("full_name", None), - } - templates = ['confirmation/confirm_preregistrationuser.html'] - return render(request, templates, context=ctx) + return render(request, 'confirmation/confirm_preregistrationuser.html', + context={ + 'key': confirmation_key, + 'full_name': request.GET.get("full_name", None)}) + else: + return render(request, 'confirmation/confirm.html', context = {'confirmed': False})