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
81c94f7b
Commit
81c94f7b
authored
Jan 25, 2012
by
Sofia Papagiannaki
Browse files
minor bug fixes and improvements
parent
65d85494
Changes
3
Hide whitespace changes
Inline
Side-by-side
astakos/im/admin/forms.py
View file @
81c94f7b
...
@@ -50,6 +50,7 @@ class AdminProfileForm(forms.ModelForm):
...
@@ -50,6 +50,7 @@ class AdminProfileForm(forms.ModelForm):
"""
"""
class
Meta
:
class
Meta
:
model
=
AstakosUser
model
=
AstakosUser
exclude
=
(
'groups'
,
'user_permissions'
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
AdminProfileForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
AdminProfileForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
...
@@ -57,6 +58,4 @@ class AdminProfileForm(forms.ModelForm):
...
@@ -57,6 +58,4 @@ class AdminProfileForm(forms.ModelForm):
ro_fields
=
(
'username'
,
'date_joined'
,
'auth_token'
,
'last_login'
,
'email'
)
ro_fields
=
(
'username'
,
'date_joined'
,
'auth_token'
,
'last_login'
,
'email'
)
if
instance
and
instance
.
id
:
if
instance
and
instance
.
id
:
for
field
in
ro_fields
:
for
field
in
ro_fields
:
if
isinstance
(
self
.
fields
[
field
].
widget
,
forms
.
CheckboxInput
):
self
.
fields
[
field
].
widget
.
attrs
[
'disabled'
]
=
True
self
.
fields
[
field
].
widget
.
attrs
[
'readonly'
]
=
True
self
.
fields
[
field
].
widget
.
attrs
[
'readonly'
]
=
True
\ No newline at end of file
astakos/im/admin/views.py
View file @
81c94f7b
...
@@ -73,7 +73,7 @@ def requires_admin(func):
...
@@ -73,7 +73,7 @@ def requires_admin(func):
@
wraps
(
func
)
@
wraps
(
func
)
def
wrapper
(
request
,
*
args
):
def
wrapper
(
request
,
*
args
):
if
not
settings
.
BYPASS_ADMIN_AUTH
:
if
not
settings
.
BYPASS_ADMIN_AUTH
:
if
isinstance
(
request
.
user
,
A
nonymous
User
):
if
request
.
user
.
is_a
nonymous
(
):
next
=
urlencode
({
'next'
:
request
.
build_absolute_uri
()})
next
=
urlencode
({
'next'
:
request
.
build_absolute_uri
()})
login_uri
=
reverse
(
index
)
+
'?'
+
next
login_uri
=
reverse
(
index
)
+
'?'
+
next
return
HttpResponseRedirect
(
login_uri
)
return
HttpResponseRedirect
(
login_uri
)
...
...
astakos/im/views.py
View file @
81c94f7b
...
@@ -296,9 +296,9 @@ def signup(request, template_name='signup.html', extra_context={}, backend=None)
...
@@ -296,9 +296,9 @@ def signup(request, template_name='signup.html', extra_context={}, backend=None)
signup.html or ``template_name`` keyword argument.
signup.html or ``template_name`` keyword argument.
"""
"""
if
not
backend
:
backend
=
get_backend
(
request
)
try
:
try
:
if
not
backend
:
backend
=
get_backend
(
request
)
form
=
backend
.
get_signup_form
()
form
=
backend
.
get_signup_form
()
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
if
form
.
is_valid
():
if
form
.
is_valid
():
...
...
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