I am trying to implement a search system in my Django apps.
For example, I have many service sellers person in a city.
When user Search by its location that will google map autosuggest in my form search field. After users/clients click on choose a location, they will get all the salesperson location nearby the location they are expecting.
The search system will look like these websites:
https://www.foodpanda.com.bd/
https://www.justdial.com/
https://www.hungrynaki.com/
I am not getting should I use GeoDjango
or not. I know I need to use google API but I am not getting how to store the location data in my database. I see GeoDjango
solves this problem very well, yet I am confused if GeoDjango
is a good fit for my project.
Your suggestion much appreciated,
Both is possible. Quite hard to tell if GeoDjango ist the best fit for you. To answer your question how to store loaction data in your database without using GeoDjango:
Just create a new Model with all the Address details you need. Maybe it is something like this:
class Location(models.Model):
latitude = models.FloatField(null=True, default=None, verbose_name="location latitude")
longitude = models.FloatField(null=True, default=None, verbose_name="location longitude")
street = models.CharField(max_length=100, verbose_name="street")
zip_code = models.CharField(max_length=100, verbose_name="zip code")
city = models.CharField(max_length=100, verbose_name="city")
country = models.CharField(max_length=100, verbose_name="country")
As a third option you could use: https://github.com/caioariede/django-location-field