from locations.models import CheckIn
from django.contrib.gis.geos import GEOSGeometry


def convertll(lat, lon):
    pnt = GEOSGeometry('POINT({0} {1})'.format(lon, lat), srid=4326)
    pnt.transform(3857)
    return pnt.y, pnt.x


def get_latlon():
    loc = CheckIn.objects.latest()
    lat_converted, lon_converted = convertll(loc.lat, loc.lon)
    return lat_converted, lon_converted