=====
Usage
=====
Read here how to use Storelocator after installing.
Data sources
------------
The Storelocator depends on external data.
Data for the ``Shop`` model can be provided for by the user.
Data for the ``Location`` model can be imported from third party sources. Locations are needed
in case the API is called with a postalcode. In this situation the center position
is the center position of the postalcode area.
We recommend Geonames as an external datasource for our ``Location`` models.
This data can be downloaded from `Geonames `_
in csv format.
Management commands
-------------------
The available management commands are listed here.
import_locations
~~~~~~~~~~~~~~~~~~~~~~~
Imports locations from a geonames csv file.
Example usage::
django-admin.py import_locations locations.csv
import_shops
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Imports shops from a csv file. The csv file needs to have the following field
order:
``type``, ``name``, ``street``, ``postalcode``, ``city``, ``state``, ``iso``
You also have to store a ``StoreLocator`` object to the database before creating shops.
The id of your object should be used as a second argument for this management command.
Example usage::
django-admin.py import_shops shops.csv 1
update_shops
~~~~~~~~~~~~~~~~~~~~~~
Updates the ``longitude`` and ``latitude`` fields on ``Shop`` objects by using
your service of choice.
The services you can choose are:
- ``google`` This uses Google's Geocoding API.
- ``yahoo`` This uses Yahoo's yql.
Example usage::
django-admin.py update_shops yahoo
Note:
Currently the google variant does not support authentication and supports
only 2500 requests a day.
update_locations