from django import template register = template.Library() @register.filter def form_row(value): # Change the template string below to suit your needs. row = template.Template("""