Cleanup minor bugs from new homepage

This commit is contained in:
Michael Hall 2018-02-14 23:42:01 -02:00
parent 36459b11da
commit db7eda85cf
3 changed files with 4 additions and 4 deletions

View file

@ -71,7 +71,7 @@ def city_list(request, *args, **kwargs):
if "spr" in request.GET and request.GET.get("spr") is not "":
cities = cities.filter(spr=request.GET.get("spr"))
serializer = CitySerializer(cities[:20], many=True)
serializer = CitySerializer(cities[:50], many=True)
return Response(serializer.data)
@api_view(['GET'])

View file

@ -26,7 +26,7 @@
<div class="container">
<div class="row navbar-dark bg-dark mb-3">
<div class="col-12 navbar-text">
<form target="{% url 'home' %} method="GET">{{search_form}} <input type="submit" value="Search" class="btn btn-primary btn-sm"></form>
<form action="{% url 'home' %}" method="GET">{{search_form}} <input type="submit" value="Search" class="btn btn-primary btn-sm"></form>
</div>
</div>
{% if geoip_lookup or city_search %}

View file

@ -51,12 +51,12 @@ def home(request, *args, **kwards):
client_ip = get_client_ip(request)
if client_ip == '127.0.0.1' or client_ip == 'localhost':
if settings.DEBUG:
client_ip = '189.122.101.2' # Try Google's server
client_ip = '8.8.8.8' # Try Google's server
else:
raise Exception("Client is localhost")
g = geocoder.ip(client_ip)
if g.latlng[0] is not None and g.latlng[1] is not None:
if g.latlng is not None and g.latlng[0] is not None and g.latlng[1] is not None:
ll = g.latlng
context['geoip_lookup'] = True
except Exception as err: