From 9a30db5342e77c81e80a41d5ed70fb28476f41e9 Mon Sep 17 00:00:00 2001 From: Lincoln de Sousa Date: Tue, 25 Sep 2007 21:15:01 -0300 Subject: [PATCH] autenticando o cara depois de cadastrar como participante --- views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/views.py b/views.py index 29d5325..791951d 100644 --- a/views.py +++ b/views.py @@ -21,6 +21,7 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext, Context, loader from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.models import Group, User +from django.contrib.auth import authenticate, login from django.newforms import form_for_instance from django.core.mail import EmailMessage from django.db import transaction @@ -165,8 +166,10 @@ def inscricao_individual(request): p.home_page = cd['home_page'] p.save() - ok = True + u = authenticate(username=cd['nome_usuario'], password=cd['senha']) + login(request, u) transaction.commit() + ok = True c = {'form': form, 'ok': ok} return build_response(request, 'inscricao_individual.html', c) @@ -207,6 +210,8 @@ def inscricao_caravana(request): c.save() ok = True + u = authenticate(username=cd['nome_usuario'], password=cd['senha']) + login(request, u) transaction.commit() c = {'form': form, 'ok': ok} @@ -228,7 +233,7 @@ def submeter_trabalho(request): t.descricao_curta = cd['descricao_curta'] t.descricao_longa = cd['descricao_longa'] t.recursos = cd['recursos'] - t.evento = Evento.objects.get(pk=1) # let the hammer play arround! + t.evento = Evento.objects.get(pk=1) # XXX: let the hammer play arround! t.save() logged_in = request.user.palestrante_set.get() -- 2.20.1