<commit_before>import datetime
from django.shortcuts import get_object_or_404, render
from .models import Post, Comment
from .forms import CommentForm
import markdown2

# Create your views here.
def post(request, slug):
	p = get_object_or_404(Post, slug=slug)
	if request.method == 'POST':
		form = CommentForm(request.POST)
		if form.is_valid():
			cd = form.cleaned_data
			new_comment = Comment.objects.create(
				time=datetime.datetime.now(),
				name=cd['name'],
				content=cd['content'],
				post=p)
	else:
		form = CommentForm()
	comments = Comment.objects.filter(post=p)
	print(comments)
	context = {
		'title': p.title, 
		'date': p.date, 
		'content': markdown2.markdown(p.content),
		'comments': comments,
		'comment_form': form}
	return render(request, 'post.html', context)

def home(request):
	posts = Post.objects.all()
	context = {'posts': posts}
	return render(request, 'home.html', context)<commit_msg>switch to mistune<commit_after>import datetime
from django.shortcuts import get_object_or_404, render
from .models import Post, Comment
from .forms import CommentForm
import mistune

# Create your views here.
def post(request, slug):
	p = get_object_or_404(Post, slug=slug)
	if request.method == 'POST':
		form = CommentForm(request.POST)
		if form.is_valid():
			cd = form.cleaned_data
			new_comment = Comment.objects.create(
				time=datetime.datetime.now(),
				name=cd['name'],
				content=cd['content'],
				post=p)
	else:
		form = CommentForm()
	comments = Comment.objects.filter(post=p)
	print(comments)
	context = {
		'title': p.title, 
		'date': p.date, 
		'content': mistune.markdown(p.content),
		'comments': comments,
		'comment_form': form}
	return render(request, 'post.html', context)

def home(request):
	posts = Post.objects.all()
	context = {'posts': posts}
	return render(request, 'home.html', context)
{'fraction_non_alphanumeric': 0.13774403470715835, 'fraction_numerical': 0.007592190889370932, 'mean_word_length': 4.712074303405573, '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': '5785311', 'n_tokens_mistral': 676, 'n_tokens_neox': 608, 'n_words': 151}