GeoDjango how to display distance in meters in this query
Right now I'm just displaying them by distance ranking.
I would like to get the distance in meters more
models.py
class Master(models.Model):
city_master = models.ForeignKey(myCity, on_delete=models.CASCADE, null=True, blank=True, verbose_name="cityName", db_index=True, related_name="CityName_relate")
country_master = models.ForeignKey(CountryMy, on_delete=models.CASCADE, null=True, blank=True, verbose_name="countryName", db_index=True, related_name="CountryMyName_relate")
name = models.CharField(blank=True, null=True, max_length=3000)
point = models.PointField(blank=True, null=True)
views.py
from django.contrib.gis.db.models.functions import Distance
class MainList(View):
.....
def get(self, request):
........
current_location = BaseUrl.objects.get(Country__nameCountry_for_sites=str(country)).point
main_masters_in_country = myCity.objects.filter(
point__distance_lte=((current_location, D(km=50)))).annotate(
distance=Distance('point', current_location)).order_by('distance')[:5]
return render(request, self.template_name, context={'main_masters_in_country': main_masters_in_country}, )
I would like to get the distance in meters more
Thanks friends/謝謝朋友/Gracias amigos/Danke Freunde/Merci les amis/धन्यवाद दोस्तों/Спасибо друзья