Update by ialbert on Fri Oct 27 15:09:57 EDT 2017 from yolo.local
# import os
+from operator import itemgetter
+
import mistune
from django.conf import settings
# from django.template.loader import get_template
from django.contrib import messages
from django.contrib.auth.decorators import login_required
+from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import render, redirect
from django.urls import reverse
-from django.contrib.auth.decorators import user_passes_test
from . import tasks, auth
from .forms import *
from .models import (User, Project, Data,
- Analysis, Job, get_datatype)
+ Analysis, Job)
def join(*args):
@@ -99,7 +101,6 @@ def site_admin(request):
def project_list(request):
-
projects = Project.objects.order_by("-id")
steps = breadcrumb_builder([HOME_ICON, PROJECT_LIST_ICON])
@@ -180,7 +181,6 @@ def data_list(request, id):
return render(request, "data_list.html", context)
-
# @login_required
def data_view(request, id):
data = Data.objects.filter(id=id).first()
@@ -261,7 +261,6 @@ def analysis_list(request, id):
project = Project.objects.filter(id=id).first()
analysis = Analysis.objects.filter(project=project).order_by("-id")
-
if not request.user.is_superuser:
analysis = analysis.filter(type=Analysis.USER).all()
@@ -446,6 +445,12 @@ def job_files_list(request, id, path=''):
# These are pathlike objects with attributes such as name, is_file
file_list = list(os.scandir(target_path))
+ file_list = [(elem.is_dir(), elem) for elem in file_list]
+ file_list = sorted(file_list, key=itemgetter(0), reverse=True)
+ file_list = [b for a, b in file_list]
+
+ # Sort to put the directories first
+ # file_list = sorted(file_list, key=attrgetter('is_dir'))
steps = breadcrumb_builder(
[PROJECT_LIST_ICON, PROJECT_ICON, RESULT_LIST_ICON, RESULT_VIEW_ICON, RESULT_INDEX_ICON],
