Skip to content

Instantly share code, notes, and snippets.

@mpdaugherty
Created July 12, 2012 00:50
Show Gist options
  • Save mpdaugherty/3094847 to your computer and use it in GitHub Desktop.
Save mpdaugherty/3094847 to your computer and use it in GitHub Desktop.
plain text indent django template tag
from django import template
register = template.Library()
@register.filter(name='indent')
def indent_string(val, num_spaces=4):
return val.replace('\n', '\n' + ' '*num_spaces)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment