summaryrefslogtreecommitdiffstats
path: root/expo/views_other.py
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-14 06:19:46 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-14 06:19:46 +0100
commite9e755b5175b47a4dbb69ac114428660bb2e12a8 (patch)
tree7d84cc3f309f90bceed9c48a71999b9306656fda /expo/views_other.py
parent191619e6d82f6ff2747b13d355064922407c762c (diff)
downloadtroggle-e9e755b5175b47a4dbb69ac114428660bb2e12a8.tar.gz
troggle-e9e755b5175b47a4dbb69ac114428660bb2e12a8.tar.bz2
troggle-e9e755b5175b47a4dbb69ac114428660bb2e12a8.zip
[svn] Fixed broken buttons on controlpanel, added CAVETAB2.CSV export and download buttons and made them work too.
Changed ordering on PersonExpeditions so that it is based on their expedition. That way, even if we don't have date info on when a user was on expo exactly, pages like personindex work correctly.
Diffstat (limited to 'expo/views_other.py')
-rw-r--r--expo/views_other.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/expo/views_other.py b/expo/views_other.py
index 0f8cb79..1b3b64f 100644
--- a/expo/views_other.py
+++ b/expo/views_other.py
@@ -5,8 +5,7 @@ from django.db.models import Q
import databaseReset
import re
import randSent
-from django.http import HttpResponse
-
+from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from troggle.alwaysUseRequestContext import render_response # see views_logbooks for explanation on this.
@@ -62,9 +61,20 @@ def calendar(request,year):
def controlPanel(request):
message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"})
if request.method=='POST':
- for item in request.POST:
- if request.user.is_superuser and item!='item':
- print "running"+ " databaseReset."+item+"()"
- exec "databaseReset."+item+"()"
+ if request.user.is_superuser:
+ for item in request.POST:
+ if item!='item':
+ print "running"+ " databaseReset."+item+"()"
+ exec "databaseReset."+item+"()"
+ else:
+ return HttpResponseRedirect(reverse('auth_login'))
+
+ return render_response(request,'controlPanel.html', )
- return render_response(request,'controlPanel.html', ) \ No newline at end of file
+def downloadCavetab(request):
+ from export import tocavetab
+ response = HttpResponse(mimetype='text/csv')
+ response['Content-Disposition'] = 'attachment; filename=CAVEETAB2.CSV'
+ tocavetab.writeCaveTab(response)
+ return response
+ \ No newline at end of file