JourneyJoker/auction/helpers.py
Klaus-Uwe Mitterer 41d71d313f Preparing a bunch of views for partners
Adding superior ratings
Use Nominatim for location lookups
Implement hotel registration
2021-04-11 16:19:43 +02:00

13 lines
No EOL
399 B
Python

from django.conf import settings
from geopy.geocoders import Nominatim
def name_to_coords(name):
geocoder = Nominatim(user_agent="JourneyJoker.at")
result = geocoder.geocode(name, exactly_one=True)
return result.latitude, result.longitude
def profile_to_coords(profile):
return name_to_coords("%s, %s, %s, %s" % (profile.address, profile.city, profile.zip, profile.country))