I am running this code:
city_state_location = (
Location.objects.filter(city=city, state=state)
.values_list("city")
.annotate(long=Avg("longitude"), lat=Avg("latitude"))
)
print(
city_state_location,
city_state_location[0],
city_state_location.first(),
len(city_state_location),
)
Which outputs:
<QuerySet [('New York', -73.9422666666667, 40.8382)]>
('New York', -73.9422666666667, 40.8382)
('New York', -73.9501, 40.8252)
1
Why does this happen? The query set only contains one element so I'm confused why indexing the first element is any different then calling .first()
This is running on Django 2.2.7