def regist(req): if req.method == 'POST': uf = UserForm(req.POST) if uf.is_valid(): username = uf.cleaned_data['username'] password = uf.cleaned_data['password'] User.objects.create(username=username, password=password) return HttpResponseRedirect('/login/') else: uf = UserForm() return render_to_response('regist.html', {'uf': uf})
def regist(req): if req.method == 'POST': uf = UserForm(req.POST) if uf.is_valid(): username = uf.cleaned_data['username'] password = uf.cleaned_data['password'] User.objects.create(username = username, password = password) return HttpResponseRedirect('/login/') else: uf = UserForm() return render_to_response('regist.html', {'uf':uf})
def login(req): if req.method == 'POST': uf = UserForm(req.POST) if uf.is_valid(): username = uf.cleaned_data['username'] password = uf.cleaned_data['password'] user = User.objects.filter(username__exact = username, password__exact = password) if user: req.session['username'] = username # read issue type from db issue = IssueType.objects.all() #return HttpResponseRedirect('/index/', {'issue':issue}) return render_to_response('index.html', {'issue':issue}) else: return HttpResponseRedirect('/login/') else: uf = UserForm() return render_to_response('login.html', {'uf':uf})
def login(req): if req.method == 'POST': uf = UserForm(req.POST) if uf.is_valid(): username = uf.cleaned_data['username'] password = uf.cleaned_data['password'] user = User.objects.filter(username__exact=username, password__exact=password) if user: req.session['username'] = username # read issue type from db issue = IssueType.objects.all() #return HttpResponseRedirect('/index/', {'issue':issue}) return render_to_response('index.html', {'issue': issue}) else: return HttpResponseRedirect('/login/') else: uf = UserForm() return render_to_response('login.html', {'uf': uf})