projects
/
oweals
/
karmaworld.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b7ebe2b
)
adding model method for sanitize_html
author
Seth Woodworth
<seth@sethish.com>
Thu, 18 Apr 2013 21:28:54 +0000
(17:28 -0400)
committer
Seth Woodworth
<seth@sethish.com>
Thu, 18 Apr 2013 21:28:54 +0000
(17:28 -0400)
karmaworld/apps/notes/models.py
patch
|
blob
|
history
diff --git
a/karmaworld/apps/notes/models.py
b/karmaworld/apps/notes/models.py
index a9606211aac9a20afc4a12937cb15d155a466384..f34bb333deb06c67bdce09d312544c842f17f83e 100644
(file)
--- 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 <a> 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)