<commit_before>from django.http import HttpResponse
from django.shortcuts import render_to_response
from .models import Resource

def index(request):
    return render_to_response("index.html")

def allresources(request):
	mdict = {
		"resources": Resource.objects.all()
	}
	return render_to_response("resources_main.html", mdict)

def specificresource(request, resource_pk):
	mdict = {
		"resource": Resource.objects.get(pk=resource_pk)
	}
	return render_to_response("resource.html", mdict)<commit_msg>Add check to make sure resource exists<commit_after>from django.http import Http404
from django.shortcuts import render_to_response
from .models import Resource

def index(request):
    return render_to_response("index.html")

def allresources(request):
	mdict = {
		"resources": Resource.objects.all()
	}
	return render_to_response("resources_main.html", mdict)

def specificresource(request, resource_pk):
	try:
		mdict = {
			"resource": Resource.objects.get(pk=resource_pk)
		}
	except Resource.DoesNotExist:
		raise Http404("No resources with that primary key were found.")
	return render_to_response("resource.html", mdict)
{'fraction_non_alphanumeric': 0.10247349823321555, 'fraction_numerical': 0.00530035335689046, 'mean_word_length': 6.170886075949367, 'pattern_counts': {'":': 4, '<': 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': '6482834', 'n_tokens_mistral': 356, 'n_tokens_neox': 340, 'n_words': 83}