better localization
This commit is contained in:
@@ -67,6 +67,9 @@
|
|||||||
{% if location %}
|
{% if location %}
|
||||||
<p>
|
<p>
|
||||||
<a href="/rowers/list-courses/?nearby=true">Filter nearby courses</a>
|
<a href="/rowers/list-courses/?nearby=true">Filter nearby courses</a>
|
||||||
|
{{ city }} {{ country_name }} {{ time_zone }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<a href="/rowers/list-courses/">All courses</a>
|
<a href="/rowers/list-courses/">All courses</a>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -77,6 +77,9 @@
|
|||||||
{% if location %}
|
{% if location %}
|
||||||
<p>
|
<p>
|
||||||
<a href="/rowers/virtualevents/?nearby=true">Challenges in your area</a>
|
<a href="/rowers/virtualevents/?nearby=true">Challenges in your area</a>
|
||||||
|
{{ city }} {{ country_name }} {{ time_zone }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<a href="/rowers/virtualevents/">All Challenges</a>
|
<a href="/rowers/virtualevents/">All Challenges</a>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -13,13 +13,18 @@ from django.contrib.gis.geoip2 import GeoIP2
|
|||||||
def courses_view(request):
|
def courses_view(request):
|
||||||
r = getrower(request.user)
|
r = getrower(request.user)
|
||||||
g = GeoIP2()
|
g = GeoIP2()
|
||||||
ip = request.META.get('REMOTE_ADDR')
|
|
||||||
|
ip = request.META.get('HTTP_X_REAL_IP','1.1.1.1')
|
||||||
try:
|
try:
|
||||||
lat_lon = g.lat_lon(ip)
|
lat_lon = g.lat_lon(ip)
|
||||||
city = g.city(ip)
|
city = g.city(ip)
|
||||||
except:
|
except:
|
||||||
lat_lon = None
|
lat_lon = None
|
||||||
city = None
|
city = {
|
||||||
|
'city': None,
|
||||||
|
'country_name': None,
|
||||||
|
'time_zone': None,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
courses = GeoCourse.objects.all().order_by("country","name","distance")
|
courses = GeoCourse.objects.all().order_by("country","name","distance")
|
||||||
@@ -58,6 +63,9 @@ def courses_view(request):
|
|||||||
'searchform':searchform,
|
'searchform':searchform,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'location':lat_lon,
|
'location':lat_lon,
|
||||||
|
'city':city['city'],
|
||||||
|
'country_name': city['country_name'],
|
||||||
|
'time_zone':city['time_zone'],
|
||||||
})
|
})
|
||||||
|
|
||||||
# List Courses
|
# List Courses
|
||||||
@@ -671,13 +679,17 @@ def virtualevents_view(request):
|
|||||||
is_ajax = True
|
is_ajax = True
|
||||||
|
|
||||||
g = GeoIP2()
|
g = GeoIP2()
|
||||||
ip = request.META.get('REMOTE_ADDR')
|
ip = request.META.get('HTTP_X_REAL_IP','1.1.1.1')
|
||||||
try:
|
try:
|
||||||
lat_lon = g.lat_lon(ip)
|
lat_lon = g.lat_lon(ip)
|
||||||
city = g.city(ip)
|
city = g.city(ip)
|
||||||
except:
|
except:
|
||||||
lat_lon = None
|
lat_lon = None
|
||||||
city = None
|
city = {
|
||||||
|
'city': None,
|
||||||
|
'country_name': None,
|
||||||
|
'time_zone': None,
|
||||||
|
}
|
||||||
|
|
||||||
# default races
|
# default races
|
||||||
races1 = VirtualRace.objects.filter(
|
races1 = VirtualRace.objects.filter(
|
||||||
@@ -773,6 +785,9 @@ def virtualevents_view(request):
|
|||||||
{ 'races':races,
|
{ 'races':races,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'location': lat_lon,
|
'location': lat_lon,
|
||||||
|
'city':city['city'],
|
||||||
|
'country_name': city['country_name'],
|
||||||
|
'time_zone':city['time_zone'],
|
||||||
})
|
})
|
||||||
|
|
||||||
breadcrumbs = [
|
breadcrumbs = [
|
||||||
@@ -789,6 +804,9 @@ def virtualevents_view(request):
|
|||||||
'active':'nav-racing',
|
'active':'nav-racing',
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'location': lat_lon,
|
'location': lat_lon,
|
||||||
|
'city':city['city'],
|
||||||
|
'country_name': city['country_name'],
|
||||||
|
'time_zone':city['time_zone'],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user