forked from expo/troggle
[svn] Have control panel display an error for logged in, non-superuser users.
This commit is contained in:
parent
14b39d906c
commit
b091e8eb09
@ -65,7 +65,7 @@ def controlPanel(request):
|
|||||||
if request.user.is_superuser:
|
if request.user.is_superuser:
|
||||||
|
|
||||||
#importlist is mostly here so that things happen in the correct order.
|
#importlist is mostly here so that things happen in the correct order.
|
||||||
#http post data seems to come in an unpredictable order, we do it this way.
|
#http post data seems to come in an unpredictable order, so we do it this way.
|
||||||
importlist=['reload_db', 'import_people', 'import_cavetab', 'import_logbooks', 'import_surveys', 'import_QMs']
|
importlist=['reload_db', 'import_people', 'import_cavetab', 'import_logbooks', 'import_surveys', 'import_QMs']
|
||||||
databaseReset.make_dirs()
|
databaseReset.make_dirs()
|
||||||
for item in importlist:
|
for item in importlist:
|
||||||
@ -74,7 +74,10 @@ def controlPanel(request):
|
|||||||
exec "databaseReset."+item+"()"
|
exec "databaseReset."+item+"()"
|
||||||
jobs_completed.append(item)
|
jobs_completed.append(item)
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect(reverse('auth_login'))
|
if request.user.is_authenticated(): #The user is logged in, but is not a superuser.
|
||||||
|
return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'error':'You must be a superuser to use that feature.'})
|
||||||
|
else:
|
||||||
|
return HttpResponseRedirect(reverse('auth_login'))
|
||||||
|
|
||||||
return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'jobs_completed':jobs_completed})
|
return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'jobs_completed':jobs_completed})
|
||||||
|
|
||||||
|
@ -340,4 +340,8 @@ h1 {
|
|||||||
|
|
||||||
#quicksearch {
|
#quicksearch {
|
||||||
margin-left:40px;
|
margin-left:40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noticeBox {
|
||||||
|
border:thin black solid; width: 40%; color:#F00; margin-left:auto; margin-right:auto
|
||||||
}
|
}
|
@ -1,9 +1,8 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
{% if jobs_completed %}
|
{% if jobs_completed %}
|
||||||
<div style="border:thin black solid; width: 40%; color:#F00; margin-left:auto; margin-right:auto">
|
<div class="noticeBox">
|
||||||
Just finished running:
|
Just finished running:
|
||||||
<ul>
|
<ul>
|
||||||
{% for job in jobs_completed %}
|
{% for job in jobs_completed %}
|
||||||
@ -15,6 +14,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if error %}
|
||||||
|
<div class="noticeBox">
|
||||||
|
{{ error }}
|
||||||
|
<a href="#" class="closeDiv">dismiss this message</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<form name="reset" method="post" action="">
|
<form name="reset" method="post" action="">
|
||||||
<h3>Wipe:</h3>
|
<h3>Wipe:</h3>
|
||||||
|
Loading…
Reference in New Issue
Block a user