Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
65d85494
Commit
65d85494
authored
Jan 25, 2012
by
Sofia Papagiannaki
Browse files
fill first name and last name in invited user registration form
Refs: #1915
parent
dcf55476
Changes
1
Hide whitespace changes
Inline
Side-by-side
astakos/im/backends/__init__.py
View file @
65d85494
...
...
@@ -54,7 +54,7 @@ import logging
def
get_backend
(
request
):
"""
Return an instance of a registration backend,
Return
s
an instance of a registration backend,
according to the INVITATIONS_ENABLED setting
(if True returns ``astakos.im.backends.InvitationsBackend`` and if False
returns ``astakos.im.backends.SimpleBackend``).
...
...
@@ -105,16 +105,20 @@ class InvitationsBackend(object):
"""
request
=
self
.
request
formclass
=
'ExtendedUserCreationForm'
initial_data
=
None
if
self
.
invitation
:
formclass
=
'Invited%s'
%
formclass
initial_data
=
None
if
request
.
method
==
'GET'
:
initial_data
=
{
'username'
:
self
.
invitation
.
username
,
'email'
:
self
.
invitation
.
username
,
'realname'
:
self
.
invitation
.
realname
}
inviter
=
AstakosUser
.
objects
.
get
(
username
=
self
.
invitation
.
inviter
)
initial_data
[
'inviter'
]
=
inviter
.
realname
else
:
if
self
.
invitation
:
# create a tmp user with the invitation realname
# to extract first and last name
u
=
AstakosUser
(
realname
=
self
.
invitation
.
realname
)
initial_data
=
{
'username'
:
self
.
invitation
.
username
,
'email'
:
self
.
invitation
.
username
,
'inviter'
:
self
.
invitation
.
inviter
.
realname
,
'first_name'
:
u
.
first_name
,
'last_name'
:
u
.
last_name
}
elif
request
.
method
==
'POST'
:
initial_data
=
request
.
POST
return
globals
()[
formclass
](
initial_data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment