projects
/
cascardo
/
eventmanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cc98df1
)
arrumando o cadastro de palestrantes
author
Lincoln de Sousa
<pythonwarrior@pidinti.localdomain>
Thu, 9 Aug 2007 18:40:45 +0000
(15:40 -0300)
committer
Lincoln de Sousa
<pythonwarrior@pidinti.localdomain>
Thu, 9 Aug 2007 18:40:45 +0000
(15:40 -0300)
views.py
patch
|
blob
|
history
diff --git
a/views.py
b/views.py
index
5e29b40
..
9d5d50a
100644
(file)
--- a/
views.py
+++ b/
views.py
@@
-47,17
+47,16
@@
def index(request):
@enable_login_form
def cadastro(request):
@enable_login_form
def cadastro(request):
+ c = {}
if request.POST:
# django's newforms lib requires a new instance of a form to be bounded
# with data, to be validated and used.
form = CadastroPalestrante(request.POST)
if form.is_valid():
cd = form.cleaned_data
if request.POST:
# django's newforms lib requires a new instance of a form to be bounded
# with data, to be validated and used.
form = CadastroPalestrante(request.POST)
if form.is_valid():
cd = form.cleaned_data
+ badattr = form.errors
wrong = False
wrong = False
- # XXX: really ugly hack to use django validation machinary...
- badattr = form._BaseForm__errors
-
if not cd['telefone_comercial'] and \
not cd['telefone_residencial'] and \
not cd['telefone_celular']:
if not cd['telefone_comercial'] and \
not cd['telefone_residencial'] and \
not cd['telefone_celular']:
@@
-76,11
+75,13
@@
def cadastro(request):
if not wrong:
group = Group.objects.get_or_create(name='palestrantes')[0]
if not wrong:
group = Group.objects.get_or_create(name='palestrantes')[0]
+ user = User(username=cd['nome_usuario'], email=cd['email'])
+ user.set_password(cd['senha'])
+ user.save()
+ user.groups.add(group)
+
p = Palestrante()
p = Palestrante()
- p.user = User(username=cd['nome_usuario'], email=cd['email'])
- p.user.set_password(cd['senha'])
- p.user.save()
- p.user.groups.add(group)
+ p.usuario = user
p.nome = cd['nome_completo']
p.email = cd['email']
p.nome = cd['nome_completo']
p.email = cd['email']
@@
-110,7
+111,8
@@
def cadastro(request):
login(request, got_user)
else:
form = CadastroPalestrante()
login(request, got_user)
else:
form = CadastroPalestrante()
- return build_response(request, 'cadastro.html', {'form': form})
+ c.update({'form': form})
+ return build_response(request, 'cadastro.html', c)
@enable_login_form
@enable_login_form