On Aug 3, 3:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks! > > On Aug 3, 3:04 pm, Forest Bond <[EMAIL PROTECTED]> wrote: > > > 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 Bondhttp://www.alittletooquiet.net > > > signature.asc > > 1KDownload
For anyone trying this, I had to make it old_self = self.__class__.objects.get(id = self.id) instead of old_self = self.__class__.get(id = self.id) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---