Esempio n. 1
0
def get_location_by_id(request, id):
    """
    TODO pydoc this better
    Gets a single Location by its database ID column

    Returned, is a GeoJSON Point object with the following properties
    - id
    - address
    - pictures [URL , URL, URL] Up to three URLs
    - description
    - lot_type   TODO This is coming back as the DB string, not the descriptive English version -- change that

    Sample request:
    http://localhost:8000/services/location/123

    ID is validated in urls config, no need to repeat here
    """

    location = LOCATION_SERVICE.get_location(id=id)
    if not location:
        raise Http404

    points = conversions.location_to_point(location)

    return json_response(points)
Esempio n. 2
0
def get_location_by_id(request, id):

    location = LOCATION_SERVICE.get_location(id=id)
    if not location:
        raise Http404

    points = conversions.location_to_point(location)

    return json_response(points)