From b7985ba282597a68162d4760492f30be6a7490b9 Mon Sep 17 00:00:00 2001 From: Seth Woodworth Date: Thu, 18 Apr 2013 17:28:54 -0400 Subject: [PATCH] adding model method for sanitize_html --- karmaworld/apps/notes/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/karmaworld/apps/notes/models.py b/karmaworld/apps/notes/models.py index a960621..f34bb33 100644 --- a/karmaworld/apps/notes/models.py +++ b/karmaworld/apps/notes/models.py @@ -110,7 +110,7 @@ class Note(models.Model): # return a url ending in id return u"/{0}/{1}/{2}".format(self.course.school.slug, self.course.slug, self.id) - def sanitize_html(self): + def sanitize_html(self, save=True): """ if self contains html, find all tags and add target=_blank takes self returns True/False on succ/fail and error or count @@ -130,7 +130,8 @@ class Note(models.Model): #apply the add attribute function map(add_attribute_target, a_tags) self.html = _html - self.save() + if save: + self.save() return True, len(a_tags) -- 2.25.1