Mercurial > public > sg101
diff gpp/gcalendar/models.py @ 124:9c18250972d5
Refactored the markdown/smiley logic. Created classes for Markdown and Smilify. No longer call render_to_string() in models.py for various models.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 14 Nov 2009 04:32:32 +0000 |
parents | dbd703f7d63a |
children | 48621ba5c385 |
line wrap: on
line diff
--- a/gpp/gcalendar/models.py Sun Nov 08 21:15:31 2009 +0000 +++ b/gpp/gcalendar/models.py Sat Nov 14 04:32:32 2009 +0000 @@ -4,7 +4,9 @@ from django.db import models from django.db.models import Q from django.contrib.auth.models import User -from django.template.loader import render_to_string + +from core.markup import markdown +from smiley import smilify class PendingEventManager(models.Manager): @@ -90,12 +92,9 @@ ordering = ('-date_submitted', ) def save(self, *args, **kwargs): - html = render_to_string('gcalendar/markdown.html', {'data': self.description}) - self.html = html.strip() + self.html = smilify(markdown(self.description)) super(Event, self).save(*args, **kwargs) def needs_approval(self): return self.status in (self.NEW, self.EDIT_REQ, self.DEL_REQ) - -# vim: ts=4 sw=4