diff options
author | lxf <sng@luxagraf.net> | 2019-05-25 15:10:38 +0000 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2019-05-25 15:10:38 +0000 |
commit | dd09ca3810ea0798899870930c3efb388b776a7c (patch) | |
tree | 0cf0f8ba6c44b774a0867f48fce9cafb96620974 /app/locations | |
parent | fc037fa9bf0eee9920ae1da14ce80d594f39cba4 (diff) |
made some changes to use new checkin model
Diffstat (limited to 'app/locations')
-rw-r--r-- | app/locations/models.py | 9 |
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 |