On Fri, Aug 03, 2007 at 07:37:17PM -0000, [EMAIL PROTECTED] wrote: > > In my site_users model (which extends auth user), I've got: > > def save(self): > self.geocode = self.get_geocode() > super(SiteUser, self).save() # Call the "real" save() method. > > get_geocode makes a call out to google's geocoding service, gives the > city and state, and returns the geocode. Since there's a lot of > activity on site_users, updating for board post counts and all sorts > of other things, I don't want to call get_geocode unless city and > state have actually changed.
def save(self):
if self.id is not None:
old_self = self.__class__.get(id = self.id)
if self.id is None or (old_self.city != self.city) or (
old_self.state != self.state):
self.geocode = self.get_geocode()
super(SiteUser, self).save()
-Forest
--
Forest Bond
http://www.alittletooquiet.net
signature.asc
Description: Digital signature

