i have this thing in my models.py file
user = models.ForeignKey(\'auth.User\', unique = True)
latitude = models.DecimalField(max_digits=8,
Overwrite the save method of form to populate latitude & longitude
from django.contrib.gis.utils import GeoIP
class registerForm(forms.ModelForm):
class Meta:
model=register
fields = ('Availability', 'Status')
def save(self, ip_address, *args, **kwargs):
g = GeoIP()
lat, lon = `get the lat & lng`
user_location = super(registerForm, self).save(commit=False)
user_location.latitude = lat
user_location.longitude = lon
user_location.save(*args, **kwargs)
change this line
register = rform.save(commit=False)
to
register = rform.save(ip_address=request.META['REMOTE_ADDR'])