<commit_before>from django.shortcuts import render
from django.contrib.auth import authenticate, login, logout
from .models import Task

def index(request):
	tasks_list = Task.objects.filter(closed=False)
	context = {'tasks_list' : tasks_list, 'user' : request.user,}
	return render(request, 'taskzilla/index.html', context)

def task_page(request, task_id):
	task = Task.objects.get(pk=task_id)
	context = {'task' : task, 'comments': task.comment_set.all(), 'user' : request.user}
	return render(request, 'taskzilla/task_page.html', context)

def login_page(request):
	if request.user.is_authenticated:
		return index(request)

	if request.method == 'POST':
		username = request.POST['username']
		password = request.POST['password']
		user = authenticate(username=username, password=password)
		print(user, username, password)
		if user is not None:
			login(request, user)
			return render(request, 'taskzilla/login.html', {'loggedin' : True})
	return render(request, 'taskzilla/login.html', {'loggedin': False})

def logout_page(request):
	logout (request)
	return index(request)
<commit_msg>Views: fixed login some more<commit_after>from django.shortcuts import render
from django.contrib.auth import authenticate, login, logout
from .models import Task

def index(request):
	tasks_list = Task.objects.filter(closed=False)
	context = {'tasks_list' : tasks_list, 'user' : request.user,}
	return render(request, 'taskzilla/index.html', context)

def task_page(request, task_id):
	task = Task.objects.get(pk=task_id)
	context = {'task' : task, 'comments': task.comment_set.all(), 'user' : request.user}
	return render(request, 'taskzilla/task_page.html', context)

def login_page(request):
	if request.user.is_authenticated:
		return index(request)

	if request.method == 'POST':
		username = request.POST['username']
		password = request.POST['password']
		user = authenticate(username=username, password=password)
		print(user, username, password)
		if user is not None:
			login(request, user)
			return index(request)
		else:
			return render(request, 'taskzilla/login.html')
	return render(request, 'taskzilla/login.html')

def logout_page(request):
	logout (request)
	return index(request)

{'fraction_non_alphanumeric': 0.13102820746132848, 'fraction_numerical': 0.0, 'mean_word_length': 5.829192546583851, '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': '5480176', 'n_tokens_mistral': 733, 'n_tokens_neox': 689, 'n_words': 173}