from django import template
from django.db.models import Count
from django.utils.safestring import mark_safe
import markdown
register = template.Library()
from ..models import Post


@register.simple_tag
def total_posts():
    return Post.published.count()


@register.inclusion_tag('blog/post/latest_posts.html')
def show_latest_posts(count=5):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.inclusion_tag('home/latest_posts.html')
def show_recent_posts(count=3):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.filter(name='markdown')
def markdown_format(text):
    return mark_safe(markdown.markdown(text))


from ..models import Category


@register.inclusion_tag('blog/category/show_categories.html')
def show_categories():
    categories = Category.objects.all()
    return {'categories': categories}

9a701cc355193b76a93dc2534cfb49a9ca3c2988
<mask token>


@register.simple_tag
def total_posts():
    return Post.published.count()


<mask token>


@register.inclusion_tag('home/latest_posts.html')
def show_recent_posts(count=3):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.filter(name='markdown')
def markdown_format(text):
    return mark_safe(markdown.markdown(text))


<mask token>


@register.inclusion_tag('blog/category/show_categories.html')
def show_categories():
    categories = Category.objects.all()
    return {'categories': categories}

<mask token>


@register.simple_tag
def total_posts():
    return Post.published.count()


@register.inclusion_tag('blog/post/latest_posts.html')
def show_latest_posts(count=5):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.inclusion_tag('home/latest_posts.html')
def show_recent_posts(count=3):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.filter(name='markdown')
def markdown_format(text):
    return mark_safe(markdown.markdown(text))


<mask token>


@register.inclusion_tag('blog/category/show_categories.html')
def show_categories():
    categories = Category.objects.all()
    return {'categories': categories}

<mask token>
register = template.Library()
<mask token>


@register.simple_tag
def total_posts():
    return Post.published.count()


@register.inclusion_tag('blog/post/latest_posts.html')
def show_latest_posts(count=5):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.inclusion_tag('home/latest_posts.html')
def show_recent_posts(count=3):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.filter(name='markdown')
def markdown_format(text):
    return mark_safe(markdown.markdown(text))


<mask token>


@register.inclusion_tag('blog/category/show_categories.html')
def show_categories():
    categories = Category.objects.all()
    return {'categories': categories}

from django import template
from django.db.models import Count
from django.utils.safestring import mark_safe
import markdown
register = template.Library()
from ..models import Post


@register.simple_tag
def total_posts():
    return Post.published.count()


@register.inclusion_tag('blog/post/latest_posts.html')
def show_latest_posts(count=5):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.inclusion_tag('home/latest_posts.html')
def show_recent_posts(count=3):
    latest_posts = Post.published.order_by('-publish')[:count]
    return {'latest_posts': latest_posts}


@register.filter(name='markdown')
def markdown_format(text):
    return mark_safe(markdown.markdown(text))


from ..models import Category


@register.inclusion_tag('blog/category/show_categories.html')
def show_categories():
    categories = Category.objects.all()
    return {'categories': categories}
