Created
July 12, 2012 00:50
-
-
Save mpdaugherty/3094847 to your computer and use it in GitHub Desktop.
plain text indent django template tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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