From ad8e6c21213a4633fd60080c4b187f6fedfae7d5 Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Tue, 2 Oct 2018 14:31:45 +0200 Subject: [PATCH] [ui][registration][views] Remove old context processing It's now done by render --- beat/web/ui/registration/views.py | 44 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/beat/web/ui/registration/views.py b/beat/web/ui/registration/views.py index 000efd9d5..183f38831 100644 --- a/beat/web/ui/registration/views.py +++ b/beat/web/ui/registration/views.py @@ -91,15 +91,15 @@ def activate(request, activation_key, """ activationKey = activation_key.lower() # Normalize before trying anything with it. account = RegistrationProfile.objects.activate_user(activation_key) - if extra_context is None: - extra_context = {} - context = RequestContext(request) - for key, value in extra_context.items(): - context[key] = callable(value) and value() or value - return render(request, - template_name, - { 'account': account, - 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS }) + + context = { 'account': account, + 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS } + + if extra_context is not None: + for key, value in extra_context.items(): + context[key] = callable(value) and value() or value + + return render(request, template_name, context) @csrf_protect @@ -195,18 +195,14 @@ def register(request, success_url=None, form = form_class() form_supervisor = RegistrationFormTermsOfServiceSupervisor() - if extra_context is None: - extra_context = {} - - context = RequestContext(request) - for key, value in extra_context.items(): - context[key] = callable(value) and value() or value - - return render(request, - template_name, - { - 'form': form, - 'form_supervisor': form_supervisor, - 'supervisor_form_active': supervisor_form_active, - 'url_prefix':settings.URL_PREFIX, - }) + + context = { 'form': form, + 'form_supervisor': form_supervisor, + 'supervisor_form_active': supervisor_form_active, + 'url_prefix':settings.URL_PREFIX } + + if extra_context is not None: + for key, value in extra_context.items(): + context[key] = callable(value) and value() or value + + return render(request, template_name, context) -- GitLab