Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 53c701f

Browse files
committed
Merge pull request #391 from gandalfar/geoip_fix
Fixes GeoIP at codecatz HQ
2 parents 5d8b41f + 5cf6e7a commit 53c701f

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

web/processors/event.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313

1414
def get_client_ip(forwarded=None, remote=None):
15-
16-
if settings.DEBUG:
17-
return '93.103.53.11'
18-
1915
if forwarded:
2016
return forwarded.split(',')[0]
2117
return remote

web/templates/pages/index.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@
4242
</div>
4343
<div class="clearfix">
4444
<div id="search-events-link">
45-
<a class="btn btn-primary btn-lg"
46-
href="{% url 'web.search_events' %}?country_code={{ country.country_code }}&amp;past={{ past }}">
47-
<i class="fa fa-list"></i> List all events {% if country %}in
48-
<span id="country"> {{ country.country_name }}</span>{% endif %}
49-
</a>
45+
{% if country.country_code %}
46+
<a class="btn btn-primary btn-lg"
47+
href="{% url 'web.search_events' %}?country_code={{ country.country_code }}&amp;past={{ past }}">
48+
<i class="fa fa-list"></i> List all events <span id="country"> {{ country.country_name }}</span>
49+
</a>
50+
{% else %}
51+
<a class="btn btn-primary btn-lg" href="{% url 'web.search_events' %}">
52+
<i class="fa fa-list"></i> List all events
53+
</a>
54+
{% endif %}
5055
</div>
5156
</div>
5257

web/views/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def index(request):
5858
country = get_country_from_user_ip(user_ip)
5959

6060
try:
61-
lan_lon = get_lat_lon_from_user_ip(user_ip)
61+
lan_lon = get_lat_lon_from_user_ip(user_ip) or (58.08695, 5.58121)
6262
except GeoIPException:
6363
lan_lon = (58.08695, 5.58121)
6464

0 commit comments

Comments
 (0)