@@ -49,13 +49,16 @@ def teams_list(request, *args, **kwargs):
4949 return redirect ("all-teams" )
5050
5151 teams = request .user .profile .memberships .all ().select_related ("city" ).distinct ()
52- geo_ip = location .get_geoip (request )
53- context = {
54- "active" : "my" ,
55- "teams" : sorted (
56- teams , key = lambda team : location .team_distance_from (geo_ip .latlng , team )
57- ),
58- }
52+ try :
53+ geo_ip = location .get_geoip (request )
54+ context = {
55+ "active" : "my" ,
56+ "teams" : sorted (
57+ teams , key = lambda team : location .team_distance_from (geo_ip .latlng , team )
58+ ),
59+ }
60+ except :
61+ context = {"active" : "my" , "teams" : teams }
5962 return render (request , "get_together/teams/list_teams.html" , context )
6063
6164
@@ -66,13 +69,16 @@ def teams_list_all(request, *args, **kwargs):
6669 if team .access == Team .PUBLIC
6770 or (team .access == Team .PRIVATE and request .user .profile .is_in_team (team ))
6871 ]
69- geo_ip = location .get_geoip (request )
70- context = {
71- "active" : "all" ,
72- "teams" : sorted (
73- teams , key = lambda team : location .team_distance_from (geo_ip .latlng , team )
74- ),
75- }
72+ try :
73+ geo_ip = location .get_geoip (request )
74+ context = {
75+ "active" : "all" ,
76+ "teams" : sorted (
77+ teams , key = lambda team : location .team_distance_from (geo_ip .latlng , team )
78+ ),
79+ }
80+ except :
81+ context = {"active" : "all" , "teams" : teams }
7682 return render (request , "get_together/teams/list_teams.html" , context )
7783
7884
0 commit comments