mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 04:17:09 +00:00
compatible with Dj2.1.5
This commit is contained in:
@@ -14,8 +14,6 @@ from troggle.core.models_caves import LogbookEntry, QM, Cave, PersonTrip
|
||||
from .login import login_required_if_public
|
||||
from troggle.core.forms import UploadFileForm
|
||||
|
||||
print("** importing troggle/core/views/other.py")
|
||||
|
||||
"""Utility functions and code to serve the control panel and individual user's
|
||||
progress and task list (deprecated as we do not have individual user login).
|
||||
|
||||
@@ -31,15 +29,12 @@ def troggle404(request): # cannot get this to work. Handler404 in urls.py not ri
|
||||
#context['caves'] = Cave.objects.all()
|
||||
return render(request, ('404.html', context.flatten()))
|
||||
|
||||
def showrequest(request):
|
||||
return HttpResponse(request.GET)
|
||||
|
||||
def frontpage(request):
|
||||
'''never seen in common practice. Logon should redirect here when this is more useful'''
|
||||
# the messages system does a popup on this page if there is a recent message, e.g. from the admin site actions.
|
||||
# via django.contrib.messages.middleware.MessageMiddleware
|
||||
# this is set in the templates.
|
||||
if request.user.is_authenticated():
|
||||
if request.user.is_authenticated:
|
||||
return render(request,'tasks.html')
|
||||
|
||||
expeditions = Expedition.objects.order_by("-year")
|
||||
@@ -52,7 +47,7 @@ def frontpage(request):
|
||||
def controlPanel(request):
|
||||
jobs_completed=[]
|
||||
if request.method=='POST':
|
||||
if request.user.is_superuser:
|
||||
if request.user.is_superuser: # expoadmin is both .is_staff and ._is_superuser
|
||||
# NONE of this works now that databaseReset (now parsers.imports) has been so extensively rewritten
|
||||
reinit_db()
|
||||
import_caves()
|
||||
@@ -64,7 +59,7 @@ def controlPanel(request):
|
||||
import_survexblks()
|
||||
import_survexpos()
|
||||
else:
|
||||
if request.user.is_authenticated(): #The user is logged in, but is not a superuser.
|
||||
if request.user.is_authenticated: #The user is logged in, but is not a superuser.
|
||||
return render(request,'controlPanel.html', {'caves':Cave.objects.all(),'error':'You must be a superuser to use that feature.'})
|
||||
else:
|
||||
return HttpResponseRedirect(reverse('auth_login'))
|
||||
@@ -193,5 +188,3 @@ def delFile(f):
|
||||
pt.delete()
|
||||
lbe.delete()
|
||||
os.remove(lbe.filename)
|
||||
|
||||
print("** Finished importing troggle/core/views/other.py")
|
||||
Reference in New Issue
Block a user