<commit_before># Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.template import RequestContext
from images.models import Alignment, Original_nrrd, comp_orien, conv_orien, Upload
from system.models import Setting, Server, Template
from django.views import generic
from socket import gethostname
from django.db.models import Q
from django.contrib.auth.models import User

from images.forms import UploadForm

host = gethostname()

tempfolder = str(Server.objects.filter(host_name=host).values('temp_dir')[0]['temp_dir'])
uploaddir = str(Server.objects.filter(host_name=host).values('upload_dir')[0]['upload_dir'])

def index(request):
    if not request.user == '':
      cu = int(User.objects.filter(username=request.user).values('id')[0]['id'])
      align_list = Alignment.objects.filter(Q(user=cu) | Q(user<1)).order_by('alignment_stage', 'name')
      context = {'align_list': align_list}
      return render(request, 'index.html', context)
    else:
      return HttpResponseRedirect('/')

def detail(request, image_id):
    if not request.user == '':
      align_list = Alignment.objects.get(id=image_id)
      context = {'record': align_list}
      return render(request, 'details.html', context)
    else:
      return HttpResponseRedirect('/')
<commit_msg>syntax fix<commit_after># Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.template import RequestContext
from images.models import Alignment, Original_nrrd, comp_orien, conv_orien, Upload
from system.models import Setting, Server, Template
from django.views import generic
from socket import gethostname
from django.db.models import Q
from django.contrib.auth.models import User

from images.forms import UploadForm

host = gethostname()

tempfolder = str(Server.objects.filter(host_name=host).values('temp_dir')[0]['temp_dir'])
uploaddir = str(Server.objects.filter(host_name=host).values('upload_dir')[0]['upload_dir'])

def index(request):
    if not request.user == '':
      cu = int(User.objects.filter(username=request.user).values('id')[0]['id'])
      align_list = Alignment.objects.filter(Q(username=request.user) | Q(username='Public')).order_by('alignment_stage', 'name')
      context = {'align_list': align_list}
      return render(request, 'index.html', context)
    else:
      return HttpResponseRedirect('/')

def detail(request, image_id):
    if not request.user == '':
      align_list = Alignment.objects.get(id=image_id)
      context = {'record': align_list}
      return render(request, 'details.html', context)
    else:
      return HttpResponseRedirect('/')

{'fraction_non_alphanumeric': 0.12364031907179115, 'fraction_numerical': 0.0025380710659898475, 'mean_word_length': 5.227990970654628, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '195780', 'n_tokens_mistral': 807, 'n_tokens_neox': 806, 'n_words': 197}