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

Commit d0e6b62

Browse files
committed
Merge pull request #253 from ialja/master
Optimize some code in index view and js
2 parents 3c646d9 + 501ca26 commit d0e6b62

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

static/js/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ var Codeweek = window.Codeweek || {};
250250
document.location.hash = "!" + country_code;
251251
});
252252

253-
$("#past-link").click(function (event) {
254-
253+
$("#past-link").click(function (event) {
255254
var newUrl = $(this).attr('href') + document.location.hash;
256255
$(this).attr('href', newUrl);
257256
});

web/views/events.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from web.processors.event import get_lat_lon_from_user_ip
2828
from web.processors.event import list_countries
2929
from web.processors.event import get_country
30+
from web.processors.event import get_country_from_user_ip
3031
from web.processors.media import process_image
3132
from web.processors.media import ImageSizeTooLargeException
3233
from web.processors.media import UploadImageError
@@ -42,7 +43,7 @@
4243
"""
4344

4445

45-
def index(request, country_code=None):
46+
def index(request):
4647
template = 'pages/index.html'
4748

4849
past = request.GET.get('past', 'no')
@@ -54,8 +55,7 @@ def index(request, country_code=None):
5455
map_events = serializers.serialize('json', events, fields=('geoposition', 'title', 'pk', 'slug', 'description', 'picture'))
5556
user_ip = get_client_ip(forwarded=request.META.get('HTTP_X_FORWARDED_FOR'),
5657
remote=request.META.get('REMOTE_ADDR'))
57-
58-
country = get_country(country_code, user_ip)
58+
country = get_country_from_user_ip(user_ip)
5959

6060
try:
6161
lan_lon = get_lat_lon_from_user_ip(user_ip)

0 commit comments

Comments
 (0)