comparison accounts/views.py @ 1115:d613d25a021e

Convert login, logout, and lost username views to V3 design.
author Brian Neal <bgneal@gmail.com>
date Tue, 12 Jul 2016 21:31:09 -0500
parents 6dd1f0065859
children
comparison
equal deleted inserted replaced
1114:6dd1f0065859 1115:d613d25a021e
6 import logging 6 import logging
7 7
8 from django.http import HttpResponse 8 from django.http import HttpResponse
9 from django.shortcuts import render, redirect 9 from django.shortcuts import render, redirect
10 from django.conf import settings 10 from django.conf import settings
11 from django.views.generic import TemplateView
11 12
12 from accounts.models import PendingUser 13 from accounts.models import PendingUser
13 from accounts.forms import RegisterForm 14 from accounts.forms import RegisterForm
14 from accounts.forms import RegisterCodeForm 15 from accounts.forms import RegisterCodeForm
15 from accounts.forms import ForgotUsernameForm 16 from accounts.forms import ForgotUsernameForm
141 form.save() 142 form.save()
142 return redirect('accounts-username_sent') 143 return redirect('accounts-username_sent')
143 else: 144 else:
144 form = ForgotUsernameForm() 145 form = ForgotUsernameForm()
145 146
146 return render(request, 'accounts/username_query.html', {'form': form}) 147 return render(request, 'accounts/username_query.html', {
148 'form': form,
149 'V3_DESIGN': True,
150 })
151
152
153 class UsernameSentView(TemplateView):
154 template_name = 'accounts/username_sent.html'
155
156 def get_context_data(self, **kwargs):
157 context = super(UsernameSentView, self).get_context_data(**kwargs)
158 context['V3_DESIGN'] = True
159 return context