from django import template


register = template.Library()

@register.inclusion_tag('posts/snippets/listing.html')
def render_posts(section):
    posts = section.post_set.all()
    return dict(
        section = section,
        posts = posts,
    )

from django import template


register = template.Library()

@register.inclusion_tag('posts/snippets/listing.html', takes_context=True)
def render_posts(context, section):
    posts = section.post_set.all()
    return dict(
        request = context.request,
        posts = posts,
    )

fix posts inclusion tag by passing in context