From a5c7e99e46b155259e715e4d35acd503719e2fe9 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 9 Apr 2015 09:35:23 +0000 Subject: [PATCH] Register form now can receive access code via GET param --- shelfzilla/apps/account/views.py | 7 ++++++- shelfzilla/themes/bootflat/templates/account/register.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/shelfzilla/apps/account/views.py b/shelfzilla/apps/account/views.py index e8c6697..2b03f89 100644 --- a/shelfzilla/apps/account/views.py +++ b/shelfzilla/apps/account/views.py @@ -148,8 +148,13 @@ class RegisterView(View): form_class = RegistrationForm def get(self, request): + form_data = {} + + if 'code' in request.GET: + form_data['access_code'] = request.GET['code'] + data = { - 'form': self.form_class + 'form': self.form_class(initial=form_data) } ctx = RequestContext(request, data) diff --git a/shelfzilla/themes/bootflat/templates/account/register.html b/shelfzilla/themes/bootflat/templates/account/register.html index 1113b10..8b117d3 100644 --- a/shelfzilla/themes/bootflat/templates/account/register.html +++ b/shelfzilla/themes/bootflat/templates/account/register.html @@ -15,7 +15,7 @@

{% trans "Register" %}

-
+ {% csrf_token %} {% for field in form %}