Did anyone know how to handle python geocoder osm error if user enter invalid city name? I am using it in Django. When user input valid city name it saving to my database and showing on map but I can't stop user to put invalid city name and prevent saving to my database. here is part of my code:
right now if user give valid address then it showing on map but if user give wrong address it's saving to my database and raise this error. After deleting the wrong address from my database it's start working. How to prevent user to give wrong address and prevent saving to my database.
asked 08 Apr '21, 16:07 tusar25 |
You would have to check that your location variable has the right type of data before saving it to a database. As your geocoder probably uses nominatim, it would return an empty result if the city name entered can't be found. answered 09 Apr '21, 08:35 Spiekerooger |