@register.simple_tag(takes_context=True)
def fields_for(context, form, template=u'includes/form_fields.html'):
 context[u'form_for_fields'] = form
 return get_template(template).render(context)

@ register . simple_tag ( takes_context = True ) def fields_for ( context , form , template = u'includes/form_fields.html' ) : context [ u'form_for_fields' ] = form return get_template ( template ) . render ( context )
renders fields for a form with an optional template choice .