summaryrefslogtreecommitdiff
path: root/app/locations
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations')
-rw-r--r--app/locations/models.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/locations/models.py b/app/locations/models.py
index 6e8db7c..50fda3d 100644
--- a/app/locations/models.py
+++ b/app/locations/models.py
@@ -245,10 +245,11 @@ class LuxCheckIn(models.Model):
return self.point.y
def save(self):
- try:
- self.location = Location.objects.filter(geometry__contains=self.point).get()
- except Location.DoesNotExist:
- raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL))
+ if not self.location:
+ try:
+ self.location = Location.objects.filter(geometry__contains=self.point).get()
+ except Location.DoesNotExist:
+ raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL))
self.location_name = self.location.name
self.state_name = self.location.state.name
self.country_name = self.location.state.country.name