feat: show radius and center map
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
|
||||
import requests
|
||||
import json
|
||||
from math import radians, sqrt, sin, cos, atan2
|
||||
@@ -6,6 +8,8 @@ from math import radians, sqrt, sin, cos, atan2
|
||||
from notfellchen import __version__ as nf_version
|
||||
from notfellchen import settings
|
||||
|
||||
Position = namedtuple('Position', ['latitude', 'longitude'])
|
||||
|
||||
|
||||
def calculate_distance_between_coordinates(position1, position2):
|
||||
"""
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .geo import GeoAPI, LocationProxy
|
||||
from .geo import LocationProxy, Position
|
||||
from ..forms import AdoptionNoticeSearchForm
|
||||
from ..models import SearchSubscription, AdoptionNotice, AdoptionNoticeNotification, SexChoicesWithAll, Location
|
||||
|
||||
@@ -69,6 +69,13 @@ class Search:
|
||||
except ValueError:
|
||||
self.place_not_found = True
|
||||
|
||||
@property
|
||||
def position(self):
|
||||
if self.area_search and not self.place_not_found:
|
||||
return Position(latitude=self.location.latitude, longitude=self.location.longitude)
|
||||
else:
|
||||
return None
|
||||
|
||||
def adoption_notice_fits_search(self, adoption_notice: AdoptionNotice):
|
||||
# Make sure sex is set and sex is not set to all (then it can be disregarded)
|
||||
if self.sex is not None and self.sex != SexChoicesWithAll.ALL:
|
||||
|
Reference in New Issue
Block a user