Mercurial > public > sg101
diff gpp/messages/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/messages/models.py Sun Nov 08 21:15:31 2009 +0000 +++ b/gpp/messages/models.py Sat Nov 14 04:32:32 2009 +0000 @@ -4,7 +4,8 @@ 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 MessageManager(models.Manager): @@ -62,8 +63,7 @@ def save(self, force_insert = False, force_update = False): if not self.id: self.send_date = datetime.datetime.now() - html = render_to_string('messages/markdown.html', {'data': self.message}) - self.html = html.strip() + self.html = smilify(markdown(self.message)) super(Message, self).save(force_insert, force_update) @models.permalink