The API uses the following views for endpoints:
In addition, there are some helper functions stored in functions.py:
- exception whats_fresh.whats_fresh_api.functions.BadAddressException¶
The exception thrown if the address passed in invalid.
- whats_fresh.whats_fresh_api.functions.coordinates_from_address(street, city, state, zip)¶
This function returns a list of the coordinates from the address passed using the Google Geocoding API. If the address given does not return an exact coordinates (for instance, if the address can only be located down to the city), a BadAddressException is thrown.
TODO: this should probably return a tuple, rather than a list.
- whats_fresh.whats_fresh_api.functions.get_lat_long_prox(request, error=None)¶
Parse the latitude, longitude, proximity, and limit for the Vendor list functions.
If the parsing results in an error, the error block is updated to reflect that error.
- whats_fresh.whats_fresh_api.functions.get_limit(request, error=None)¶
Return the limit requested by the user.
If the limit results in an error, the error block is updated to reflect that error.
This decorator can be used to protect a view from users not in a given list of groups. Add @group_required to a view to require the user to be logged in and part of the passed groups. If the user is not a member of the given groups, they will be redirected to /login.
The backend, data-entry interface uses the following: