Mercurial > public > sg101
annotate forums/signals.py @ 1113:f27986c11ddf
Fix time suffix for 12 & 12:30pm.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 12 Jul 2016 19:38:54 -0500 |
parents | 5902dc5e58a3 |
children |
rev | line source |
---|---|
bgneal@75 | 1 """ |
bgneal@920 | 2 Signals for the forums application. |
bgneal@469 | 3 |
bgneal@75 | 4 """ |
bgneal@469 | 5 import django.dispatch |
bgneal@181 | 6 |
bgneal@75 | 7 |
bgneal@469 | 8 # This signal is sent when a topic has had its textual content (title) changed. |
bgneal@469 | 9 # The provided arguments are: |
bgneal@469 | 10 # sender - the topic model instance |
bgneal@469 | 11 # created - True if the topic is new, False if updated |
bgneal@469 | 12 |
bgneal@470 | 13 topic_content_update = django.dispatch.Signal(providing_args=['created']) |
bgneal@469 | 14 |
bgneal@469 | 15 # This signal is sent when a post has had its textual content (body) changed. |
bgneal@469 | 16 # The provided arguments are: |
bgneal@469 | 17 # sender - the post model instance |
bgneal@469 | 18 # created - True if the post is new, False if updated |
bgneal@469 | 19 |
bgneal@470 | 20 post_content_update = django.dispatch.Signal(providing_args=['created']) |
bgneal@469 | 21 |
bgneal@469 | 22 |
bgneal@469 | 23 def notify_new_topic(topic): |
bgneal@469 | 24 """ |
bgneal@469 | 25 Sends the topic_content_update signal for a new topic instance. |
bgneal@469 | 26 |
bgneal@469 | 27 """ |
bgneal@470 | 28 topic_content_update.send_robust(topic, created=True) |
bgneal@469 | 29 |
bgneal@469 | 30 |
bgneal@469 | 31 def notify_updated_topic(topic): |
bgneal@469 | 32 """ |
bgneal@469 | 33 Sends the topic_content_update signal for an updated topic instance. |
bgneal@469 | 34 |
bgneal@469 | 35 """ |
bgneal@470 | 36 topic_content_update.send_robust(topic, created=False) |
bgneal@469 | 37 |
bgneal@469 | 38 |
bgneal@469 | 39 def notify_new_post(post): |
bgneal@469 | 40 """ |
bgneal@469 | 41 Sends the post_content_update signal for a new post instance. |
bgneal@469 | 42 |
bgneal@469 | 43 """ |
bgneal@470 | 44 post_content_update.send_robust(post, created=True) |
bgneal@469 | 45 |
bgneal@469 | 46 |
bgneal@469 | 47 def notify_updated_post(post): |
bgneal@469 | 48 """ |
bgneal@469 | 49 Sends the post_content_update signal for an updated post instance. |
bgneal@469 | 50 |
bgneal@469 | 51 """ |
bgneal@470 | 52 post_content_update.send_robust(post, created=False) |