From 56f4c3c79f01fe1a5faa6e04e6e061de183ab7b2 Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 10 Nov 2011 21:29:22 +0530 Subject: [PATCH 1/2] make_li template tag added --- printaform/formaprint/templatetags/__init__.py | 0 printaform/formaprint/templatetags/random.py | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 printaform/formaprint/templatetags/__init__.py create mode 100644 printaform/formaprint/templatetags/random.py diff --git a/printaform/formaprint/templatetags/__init__.py b/printaform/formaprint/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/printaform/formaprint/templatetags/random.py b/printaform/formaprint/templatetags/random.py new file mode 100644 index 0000000..0ecf4a1 --- /dev/null +++ b/printaform/formaprint/templatetags/random.py @@ -0,0 +1,12 @@ +from django import template + +register = template.Library() + +def make_li(value): + lines = value.split("\n") + ret = '' + for l in lines: + ret += "
  • %s
  • " % l + return ret + +register.filter("make_li", make_li) From cedf131f4dcb04cd127fff7de14ed610726f602f Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 10 Nov 2011 21:36:23 +0530 Subject: [PATCH 2/2] mark_safe --- printaform/formaprint/templatetags/random.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/printaform/formaprint/templatetags/random.py b/printaform/formaprint/templatetags/random.py index 0ecf4a1..a17c2df 100644 --- a/printaform/formaprint/templatetags/random.py +++ b/printaform/formaprint/templatetags/random.py @@ -1,5 +1,5 @@ from django import template - +from django.utils.safestring import mark_safe register = template.Library() def make_li(value): @@ -7,6 +7,6 @@ def make_li(value): ret = '' for l in lines: ret += "
  • %s
  • " % l - return ret + return mark_safe(ret) register.filter("make_li", make_li)