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
ce86cd44
Commit
ce86cd44
authored
Jan 26, 2012
by
Sofia Papagiannaki
Browse files
in edit profile redirect to next if exists
parent
230e33e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
astakos/im/views.py
View file @
ce86cd44
...
...
@@ -223,7 +223,8 @@ def edit_profile(request, template_name='profile.html', extra_context={}):
Allows a user to edit his/her profile.
In case of GET request renders a form for displaying the user information.
In case of POST updates the user informantion.
In case of POST updates the user informantion and redirects to ``next``
url parameter if exists.
If the user isn't logged in, redirects to settings.LOGIN_URL.
...
...
@@ -243,6 +244,7 @@ def edit_profile(request, template_name='profile.html', extra_context={}):
try
:
user
=
AstakosUser
.
objects
.
get
(
username
=
request
.
user
)
form
=
ProfileForm
(
instance
=
user
)
extra_context
[
'next'
]
=
request
.
GET
.
get
(
'next'
)
except
AstakosUser
.
DoesNotExist
:
token
=
request
.
GET
.
get
(
'auth'
,
None
)
user
=
AstakosUser
.
objects
.
get
(
auth_token
=
token
)
...
...
@@ -255,6 +257,9 @@ def edit_profile(request, template_name='profile.html', extra_context={}):
messages
.
add_message
(
request
,
messages
.
SUCCESS
,
msg
)
except
ValueError
,
ve
:
messages
.
add_message
(
request
,
messages
.
ERROR
,
ve
)
next
=
request
.
POST
.
get
(
'next'
)
if
next
:
return
redirect
(
next
)
return
render_response
(
template_name
,
form
=
form
,
context_instance
=
get_context
(
request
,
...
...
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