annotate potd/signals.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents ee87ea74d46b
children
rev   line source
bgneal@532 1 """
bgneal@532 2 Signal handlers for the potd application.
bgneal@532 3
bgneal@532 4 """
bgneal@532 5 from django.db.models.signals import post_save, post_delete
bgneal@532 6
bgneal@532 7 from potd.models import Photo, Sequence
bgneal@532 8
bgneal@532 9
bgneal@532 10 def on_photo_save(sender, **kwargs):
bgneal@532 11 """
bgneal@532 12 This function is executed when a Photo is saved. It inserts the photo into
bgneal@532 13 the current sequence.
bgneal@532 14
bgneal@532 15 """
bgneal@532 16 photo = kwargs['instance']
bgneal@532 17 Sequence.objects.insert_photo(photo.pk)
bgneal@532 18
bgneal@532 19
bgneal@532 20 def on_photo_delete(sender, **kwargs):
bgneal@532 21 """
bgneal@532 22 This function is executed when a Photo is deleted. It removes the photo from
bgneal@532 23 the current sequence of photos.
bgneal@532 24
bgneal@532 25 """
bgneal@532 26 photo = kwargs['instance']
bgneal@532 27 Sequence.objects.remove_photo(photo.pk)
bgneal@532 28
bgneal@532 29
bgneal@532 30 post_save.connect(on_photo_save, sender=Photo, dispatch_uid='potd.signals')
bgneal@532 31 post_delete.connect(on_photo_delete, sender=Photo, dispatch_uid='potd.signals')