This commit is contained in:
substantialnoninfringinguser
2009-05-19 06:32:42 +01:00
parent d71078d03d
commit 2c2f11be39
17 changed files with 149 additions and 95 deletions

View File

@@ -1,4 +1,5 @@
from django.conf import settings
from expo.models import Expedition
def settings_context(request):
return { 'settings':settings }
def troggle_context(request):
return { 'settings':settings, 'Expedition':Expedition }

View File

@@ -21,7 +21,7 @@ class TroggleModel(models.Model):
return self._meta.object_name
def get_admin_url(self):
return settings.URL_ROOT + "/admin/expo/" + self.object_name.lower() + "/" + str(self.pk)
return settings.URL_ROOT + "/admin/expo/" + self.object_name().lower() + "/" + str(self.pk)
class Meta:
abstract = True

View File

@@ -93,4 +93,3 @@ def survey(request,year,wallet_number):
elevationSketches=current_survey.scannedimage_set.filter(contents='elevation')
return render_response(request,'survey.html', locals())

View File

@@ -60,17 +60,20 @@ def calendar(request,year):
return render_response(request,'calendar.html', locals())
def controlPanel(request):
message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"})
jobs_completed=[]
if request.method=='POST':
if request.user.is_superuser:
for item in request.POST:
if item!='item':
importlist=['import_people', 'import_cavetab', 'import_logbooks', 'import_surveys', 'import_QMs']
databaseReset.make_dirs()
for item in importlist:
if item in request.POST:
print "running"+ " databaseReset."+item+"()"
exec "databaseReset."+item+"()"
jobs_completed.append(item)
else:
return HttpResponseRedirect(reverse('auth_login'))
return render_response(request,'controlPanel.html', {'caves':Cave.objects.all()} )
return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'jobs_completed':jobs_completed})
def downloadCavetab(request):
from export import tocavetab
@@ -98,4 +101,9 @@ def downloadQMs(request):
response = HttpResponse(mimetype='text/csv')
response['Content-Disposition'] = 'attachment; filename=qm.csv'
toqms.writeQmTable(response,cave)
return response
return response
def ajax_test(request):
post_text = request.POST['post_data']
return HttpResponse("{'response_text': '"+post_text+" recieved.'}",
mimetype="application/json")