A simple project which handles locations in Google Maps while manipulating data in database and Google Fusion Tables. It basically:
- Validates if your location is valid (not a wood/mountain/ocean area)
- Save lat, lon and addres both to database as Google Fusion Tables
But you also can: reset both data, lists data from database, view your locations in maps retrieved from Fusion Tables.
Warning This project uses some ES6 stuff. It don't uses Angular/React/Webpack/Babel to avoid over-engineering and keep it simple.
Main django module, contains base urls.py
and settings.py
.
It centers every logic and handling to Google Fusion Tables (as name suggests). This module is highly reusable, can be set in any other Django project. Following Solid principles, you will find there:
- GoogleAuthFactory - Used to build Google Authentication stuff, like url, credentials and service. (can be found in factories.py)
- Permissions - Checks if a user can manipulate data (Already did a login, Google Auth Session not expired) (can be found in permissions.py)
- FusionTableService - Handles requests/queries to Google Fusion Tables. (can be found in services.py)
- views.py - Only one view that redirects to Google OAuth URL.
- decorators.py - You may find really cool stuff over there. It makes easy to inject new behaviors in some requests.
It requires:
- djangorestframework
- google-api-python-client
- client_secrets.json file
CREDENTIALS_KEY
andTABLE_ID
set insettings.py
This app implements models and uses service from above module. Note how it's higly decoupled from it. You will find only a bind with decorators and permissions in views.py
which handles requests to default module and uses service provided by fusiontables
.
It uses jQuery, bootstrap, and a simple third party file that extends jQuery to allows $.delete
. You will find also:
Handle Google Maps stuff like:
- Start map
- Bind fusion table to it
- Handle map click
- Validates address
Handle API stuff like:
- Save location
- Retrieve locations
- Display locations in table
- Reset locations
- Display error message
git clone https://github.com/guilatrova/django-fusion-table.git
virtualenv .ve
.ve\scripts\activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver