Commit 81c94f7b authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

minor bug fixes and improvements

parent 65d85494
......@@ -50,6 +50,7 @@ class AdminProfileForm(forms.ModelForm):
"""
class Meta:
model = AstakosUser
exclude = ('groups', 'user_permissions')
def __init__(self, *args, **kwargs):
super(AdminProfileForm, self).__init__(*args, **kwargs)
......@@ -57,6 +58,4 @@ class AdminProfileForm(forms.ModelForm):
ro_fields = ('username','date_joined', 'auth_token', 'last_login', 'email')
if instance and instance.id:
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
\ No newline at end of file
......@@ -73,7 +73,7 @@ def requires_admin(func):
@wraps(func)
def wrapper(request, *args):
if not settings.BYPASS_ADMIN_AUTH:
if isinstance(request.user, AnonymousUser):
if request.user.is_anonymous():
next = urlencode({'next': request.build_absolute_uri()})
login_uri = reverse(index) + '?' + next
return HttpResponseRedirect(login_uri)
......
......@@ -296,9 +296,9 @@ def signup(request, template_name='signup.html', extra_context={}, backend=None)
signup.html or ``template_name`` keyword argument.
"""
try:
if not backend:
backend = get_backend(request)
try:
form = backend.get_signup_form()
if request.method == 'POST':
if form.is_valid():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment