Cleanup minor bugs from new homepage
This commit is contained in:
parent
36459b11da
commit
db7eda85cf
3 changed files with 4 additions and 4 deletions
|
@ -71,7 +71,7 @@ def city_list(request, *args, **kwargs):
|
||||||
if "spr" in request.GET and request.GET.get("spr") is not "":
|
if "spr" in request.GET and request.GET.get("spr") is not "":
|
||||||
cities = cities.filter(spr=request.GET.get("spr"))
|
cities = cities.filter(spr=request.GET.get("spr"))
|
||||||
|
|
||||||
serializer = CitySerializer(cities[:20], many=True)
|
serializer = CitySerializer(cities[:50], many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
@api_view(['GET'])
|
@api_view(['GET'])
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row navbar-dark bg-dark mb-3">
|
<div class="row navbar-dark bg-dark mb-3">
|
||||||
<div class="col-12 navbar-text">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
{% if geoip_lookup or city_search %}
|
{% if geoip_lookup or city_search %}
|
||||||
|
|
|
@ -51,12 +51,12 @@ def home(request, *args, **kwards):
|
||||||
client_ip = get_client_ip(request)
|
client_ip = get_client_ip(request)
|
||||||
if client_ip == '127.0.0.1' or client_ip == 'localhost':
|
if client_ip == '127.0.0.1' or client_ip == 'localhost':
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
client_ip = '189.122.101.2' # Try Google's server
|
client_ip = '8.8.8.8' # Try Google's server
|
||||||
else:
|
else:
|
||||||
raise Exception("Client is localhost")
|
raise Exception("Client is localhost")
|
||||||
|
|
||||||
g = geocoder.ip(client_ip)
|
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
|
ll = g.latlng
|
||||||
context['geoip_lookup'] = True
|
context['geoip_lookup'] = True
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
Loading…
Reference in a new issue