gremmie@1: """ gremmie@1: Signal handlers for the membermap application. gremmie@1: We want to detect changes to the UserProfile model. If that person is on gremmie@1: the map, re-save her MapEntry so that any avatar changes get picked up. gremmie@1: """ gremmie@1: from django.db.models.signals import post_save gremmie@1: from bio.models import UserProfile gremmie@1: from membermap.models import MapEntry gremmie@1: gremmie@1: gremmie@1: def on_profile_save(sender, **kwargs): bgneal@260: import pdb; pdb.set_trace() gremmie@1: if 'instance' in kwargs: gremmie@1: profile = kwargs['instance'] bgneal@46: try: bgneal@46: map_entry = MapEntry.objects.get(user=profile.user) bgneal@46: except MapEntry.DoesNotExist: bgneal@46: # Not on the map, no harm, no foul bgneal@46: return gremmie@1: if map_entry is not None: gremmie@1: map_entry.save() gremmie@1: gremmie@1: bgneal@260: post_save.connect(on_profile_save, bgneal@260: sender=UserProfile, bgneal@260: dispatch_uid='membermap.signals')