Esempio n. 1
0
 def get_city_id(self, request):
     if 'HTTP_X_FORWARDED_FOR' in request.META:
         ip_adds = request.META['HTTP_X_FORWARDED_FOR'].split(",")
         ip = ip_adds[0]
     else:
         ip = request.META['REMOTE_ADDR']
     current_pos = self.__get_current_coords(self.__parse_ip(ip))
     print self.__parse_ip(ip)
     #if(current_pos[0] != 0 and current_pos[1] != 0):
     if current_pos != -1:
         return self.__get_id_city_by_coords(current_pos, Border.get_coords())
     return -1
Esempio n. 2
0
 def get_border_codes_by_coords(self, latitude, longitude):
     return self.__get_id_city_by_coords((latitude, longitude), Border.get_coords())