<commit_before>from django import template
from djangopress.blog.models import Entry, Blog, Category

register = template.Library()

@register.inclusion_tag('blog/show_latest.html')
def show_blog_latest(number=5, words=20, blog=None):
    blog = Blog.objects.get(slug=blog)
    try:
        number = int(number)
    except ValueError:
        number = 5
    entries_list = Entry.objects.get_entries(blog=blog)[0:number]
    return {
        "entries": entries_list,
        "words": words
    }

@register.inclusion_tag('blog/list_latest.html')
def list_blog_latest(number=5, blog=None):
    blog = Blog.objects.get(slug=blog)
    try:
        number = int(number)
    except ValueError:
        number = 5
    entries_list = Entry.objects.get_entries(blog=blog)[0:number]
    return {
        "entries": entries_list,
        "blog": blog,
    }

@register.inclusion_tag('blog/list_archive.html')
def list_blog_archive(blog):
    entries_list = Entry.objects.get_entries(blog=blog)
    dates = entries_list.dates('posted', 'month', order='DESC')
    return {
        "dates": dates,
    }

@register.inclusion_tag('blog/list_categories.html')
def list_blog_categories(blog):
    return {
        "categories": Category.objects.get_categories(blog=blog),
    }<commit_msg>fixing creash in the blog<commit_after>from django import template
from djangopress.blog.models import Entry, Blog, Category

register = template.Library()

@register.inclusion_tag('blog/show_latest.html')
def show_blog_latest(number=5, words=20, blog=None):
    blog = Blog.objects.get(slug=blog)
    try:
        number = int(number)
    except ValueError:
        number = 5
    entries_list = Entry.objects.get_entries(blog=blog)[0:number]
    return {
        "entries": entries_list,
        "words": words
    }

@register.inclusion_tag('blog/list_latest.html')
def list_blog_latest(number=5, blog=None):
    blog = Blog.objects.get(slug=blog)
    try:
        number = int(number)
    except ValueError:
        number = 5
    entries_list = Entry.objects.get_entries(blog=blog)[0:number]
    return {
        "entries": entries_list,
        "blog": blog,
    }

@register.inclusion_tag('blog/list_archive.html')
def list_blog_archive(blog):
    entries_list = Entry.objects.get_entries(blog=blog)
    dates = entries_list.datetimes('posted', 'month', order='DESC')
    return {
        "dates": dates,
    }

@register.inclusion_tag('blog/list_categories.html')
def list_blog_categories(blog):
    return {
        "categories": Category.objects.get_categories(blog=blog),
    }
{'fraction_non_alphanumeric': 0.125, 'fraction_numerical': 0.00625, 'mean_word_length': 3.631103074141049, 'pattern_counts': {'":': 12, '<': 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': '1678614', 'n_tokens_mistral': 819, 'n_tokens_neox': 816, 'n_words': 146}