<commit_before># Create your views here.
from django.template import Context, loader
from django.utils import timezone
from fmc.models import Scramble, Submission
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.core.urlresolvers import reverse
from django.core.context_processors import csrf
from rubik import *
from django.contrib import messages
from django.contrib.auth.models import User

import datetime

def index(request):
	context = {}
	context.update(csrf(request))
	populateContext(request,context)
	latest_scrambles = Scramble.objects.all().order_by('-pub_date')[:5]
	context['latest_scrambles'] = latest_scrambles
	return render_to_response('fmc/index.html', context)

def about(request):
	context = {}
	context.update(csrf(request))
	populateContext(request,context)
	return render_to_response('fmc/about.html', context)

def detail(request, scramble_id):
	context = {}
	populateContext(request,context)
	context.update(csrf(request))
	s = get_object_or_404(Scramble, pk=scramble_id)
	context['scramble'] = s<commit_msg>Autocomplete name if user is logged in<commit_after># Create your views here.
from django.template import Context, loader
from django.utils import timezone
from fmc.models import Scramble, Submission
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.core.urlresolvers import reverse
from django.core.context_processors import csrf
from rubik import *
from django.contrib import messages
from django.contrib.auth.models import User

import datetime

def index(request):
	context = {}
	context.update(csrf(request))
	populateContext(request,context)
	latest_scrambles = Scramble.objects.all().order_by('-pub_date')[:5]
	context['latest_scrambles'] = latest_scrambles
	return render_to_response('fmc/index.html', context)

def about(request):
	context = {}
	context.update(csrf(request))
	populateContext(request,context)
	return render_to_response('fmc/about.html', context)

def detail(request, scramble_id):
	context = {}
	populateContext(request,context)
	context.update(csrf(request))
	s = get_object_or_404(Scramble, pk=scramble_id)
	if (request.user):
		context['name'] = request.user.username
	context['scramble'] = s
{'fraction_non_alphanumeric': 0.09564509564509564, 'fraction_numerical': 0.00814000814000814, 'mean_word_length': 7.139072847682119, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3652922', 'n_tokens_mistral': 768, 'n_tokens_neox': 741, 'n_words': 183}