annotate gpp/membermap/signals.py @ 6:b6263ac72052

Use DRY principle to manage third party javascript libraries. Created script_tags template tags to generate the correct link and script tags for 3rd party libraries. The settings.py file is the only place where the full path name is specified.
author Brian Neal <bgneal@gmail.com>
date Sat, 11 Apr 2009 22:50:56 +0000
parents dbd703f7d63a
children 0140ff687d49
rev   line source
gremmie@1 1 """
gremmie@1 2 Signal handlers for the membermap application.
gremmie@1 3 We want to detect changes to the UserProfile model. If that person is on
gremmie@1 4 the map, re-save her MapEntry so that any avatar changes get picked up.
gremmie@1 5 """
gremmie@1 6 from django.db.models.signals import post_save
gremmie@1 7 from bio.models import UserProfile
gremmie@1 8 from membermap.models import MapEntry
gremmie@1 9
gremmie@1 10
gremmie@1 11 def on_profile_save(sender, **kwargs):
gremmie@1 12 if 'instance' in kwargs:
gremmie@1 13 profile = kwargs['instance']
gremmie@1 14 map_entry = MapEntry.objects.get(user=profile.user)
gremmie@1 15 if map_entry is not None:
gremmie@1 16 map_entry.save()
gremmie@1 17
gremmie@1 18
gremmie@1 19 post_save.connect(on_profile_save, sender=UserProfile)
gremmie@1 20
gremmie@1 21 # vim: ts=4 sw=4