* models.py * import json, urllib def getLatLon(address): address = urllib.quote_plus(address) geo = urllib.urlopen("http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=%s" % (address)) return geo.read() class location(models.Model): ... address_1 = models.CharField(max_length=200) address_2 = models.CharField(max_length=200, blank=True, null=True) address_3 = models.CharField(max_length=200, blank=True, null=True) city = models.CharField(max_length=200) postcode = models.CharField(max_length=15) ... latitude = models.FloatField(null=True, blank=True) longitude = models.FloatField(null=True, blank=True) ... def save(self, *args, **kwargs): geo = json.loads(getLatLon("%s,%s,%s,%s %s" % (self.address_1, self.address_2, self.address_3, self.city, self.postcode))) if geo['status'] == "OK": self.latitude = geo['results'][0]['geometry']['location']['lat'] self.longitude = geo['results'][0]['geometry']['location']['lng'] super(directory_list, self).save(*args, **kwargs)