Mercurial > public > sg101
comparison gpp/gcalendar/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 | e04d91babfcf |
comparison
equal
deleted
inserted
replaced
127:2d299909e074 | 128:48621ba5c385 |
---|---|
3 """ | 3 """ |
4 from django.db import models | 4 from django.db import models |
5 from django.db.models import Q | 5 from django.db.models import Q |
6 from django.contrib.auth.models import User | 6 from django.contrib.auth.models import User |
7 | 7 |
8 from core.markup import markdown | 8 from core.markup import site_markup |
9 from smiley import smilify | |
10 | 9 |
11 | 10 |
12 class PendingEventManager(models.Manager): | 11 class PendingEventManager(models.Manager): |
13 """A manager for pending events.""" | 12 """A manager for pending events.""" |
14 | 13 |
90 | 89 |
91 class Meta: | 90 class Meta: |
92 ordering = ('-date_submitted', ) | 91 ordering = ('-date_submitted', ) |
93 | 92 |
94 def save(self, *args, **kwargs): | 93 def save(self, *args, **kwargs): |
95 self.html = smilify(markdown(self.description)) | 94 self.html = site_markup(self.description) |
96 super(Event, self).save(*args, **kwargs) | 95 super(Event, self).save(*args, **kwargs) |
97 | 96 |
98 def needs_approval(self): | 97 def needs_approval(self): |
99 return self.status in (self.NEW, self.EDIT_REQ, self.DEL_REQ) | 98 return self.status in (self.NEW, self.EDIT_REQ, self.DEL_REQ) |
100 | 99 |