Mercurial > public > sg101
comparison gpp/membermap/signals.py @ 1:dbd703f7d63a
Initial import of sg101 stuff from private repository.
author | gremmie |
---|---|
date | Mon, 06 Apr 2009 02:43:12 +0000 |
parents | |
children | 0140ff687d49 |
comparison
equal
deleted
inserted
replaced
0:900ba3c7b765 | 1:dbd703f7d63a |
---|---|
1 """ | |
2 Signal handlers for the membermap application. | |
3 We want to detect changes to the UserProfile model. If that person is on | |
4 the map, re-save her MapEntry so that any avatar changes get picked up. | |
5 """ | |
6 from django.db.models.signals import post_save | |
7 from bio.models import UserProfile | |
8 from membermap.models import MapEntry | |
9 | |
10 | |
11 def on_profile_save(sender, **kwargs): | |
12 if 'instance' in kwargs: | |
13 profile = kwargs['instance'] | |
14 map_entry = MapEntry.objects.get(user=profile.user) | |
15 if map_entry is not None: | |
16 map_entry.save() | |
17 | |
18 | |
19 post_save.connect(on_profile_save, sender=UserProfile) | |
20 | |
21 # vim: ts=4 sw=4 |