comparison gpp/forums/models.py @ 128:48621ba5c385

Fixing #36, Smilify doesn't work when a smiley appears first before other text. Refactored the smiley system to produce markdown as well as HTML.
author Brian Neal <bgneal@gmail.com>
date Fri, 20 Nov 2009 01:43:32 +0000
parents 9c18250972d5
children f7a6b8fe4556
comparison
equal deleted inserted replaced
127:2d299909e074 128:48621ba5c385
4 import datetime 4 import datetime
5 5
6 from django.db import models 6 from django.db import models
7 from django.db.models import Q 7 from django.db.models import Q
8 from django.contrib.auth.models import User, Group 8 from django.contrib.auth.models import User, Group
9 from core.markup import markdown 9
10 from smiley import smilify 10 from core.markup import site_markup
11 11
12 12
13 POST_EDIT_DELTA = datetime.timedelta(seconds=3) 13 POST_EDIT_DELTA = datetime.timedelta(seconds=3)
14 14
15 15
250 250
251 def __unicode__(self): 251 def __unicode__(self):
252 return self.summary() 252 return self.summary()
253 253
254 def save(self, *args, **kwargs): 254 def save(self, *args, **kwargs):
255 self.html = smilify(markdown(self.body)) 255 self.html = site_markup(self.body)
256 super(Post, self).save(*args, **kwargs) 256 super(Post, self).save(*args, **kwargs)
257 257
258 def delete(self, *args, **kwargs): 258 def delete(self, *args, **kwargs):
259 first_post_id = self.topic.posts.all()[0].id 259 first_post_id = self.topic.posts.all()[0].id
260 super(Post, self).delete(*args, **kwargs) 260 super(Post, self).delete(*args, **kwargs)