confirmation/views: Split ctx to emphasize template use of variables.

In particular, confirm_preregistrationuser.html does not use confirmed!
This commit is contained in:
Rishi Gupta 2017-07-07 01:42:34 -07:00 committed by Tim Abbott
parent bffc7f97a5
commit 834be2d7cb
1 changed files with 6 additions and 5 deletions

View File

@ -13,6 +13,7 @@ from django.http import HttpRequest, HttpResponse
from confirmation.models import Confirmation from confirmation.models import Confirmation
from zerver.models import PreregistrationUser from zerver.models import PreregistrationUser
from typing import Any
# This is currently only used for confirming PreregistrationUser. # This is currently only used for confirming PreregistrationUser.
# Do not add other confirmation paths here. # Do not add other confirmation paths here.
@ -29,14 +30,14 @@ def confirm(request, confirmation_key):
obj = Confirmation.objects.get(confirmation_key=confirmation_key) obj = Confirmation.objects.get(confirmation_key=confirmation_key)
except Confirmation.DoesNotExist: except Confirmation.DoesNotExist:
pass pass
ctx = { ctx = {'confirmed': confirmed} # type: Dict[str, Any]
'confirmed': confirmed,
'key': confirmation_key,
'full_name': request.GET.get("full_name", None),
}
templates = [ templates = [
'confirmation/confirm.html', 'confirmation/confirm.html',
] ]
if obj: if obj:
ctx = {
'key': confirmation_key,
'full_name': request.GET.get("full_name", None),
}
templates = ['confirmation/confirm_preregistrationuser.html'] templates = ['confirmation/confirm_preregistrationuser.html']
return render(request, templates, context=ctx) return render(request, templates, context=ctx)