Mercurial > public > sg101
diff gpp/downloads/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 | a5f27f25fa52 |
children | 48621ba5c385 |
line wrap: on
line diff
--- a/gpp/downloads/models.py Sun Nov 08 21:15:31 2009 +0000 +++ b/gpp/downloads/models.py Sat Nov 14 04:32:32 2009 +0000 @@ -6,9 +6,11 @@ import datetime from django.db import models from django.contrib.auth.models import User -from django.template.loader import render_to_string from django.template.defaultfilters import filesizeformat +from core.markup import markdown +from smiley import smilify + class Category(models.Model): """Downloads belong to categories.""" @@ -72,8 +74,7 @@ return ('downloads-details', [str(self.id)]) def save(self, force_insert=False, force_update=False): - html = render_to_string('downloads/markdown.html', {'data': self.description}) - self.html = html.strip() + self.html = smilify(markdown(self.description)) super(Download, self).save(force_insert, force_update) def vote(self, vote_value):