summaryrefslogtreecommitdiff
path: root/apps/locations/admin.py
diff options
context:
space:
mode:
authorluxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f>2010-06-13 01:18:25 +0000
committerluxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f>2010-06-13 01:18:25 +0000
commitc5a6d45415c7601f9a515d05a61ee795dc37536b (patch)
treec120b44a9cc0eea9ec69a1817053f97b22e66856 /apps/locations/admin.py
parent6657ae24658383a9841450329a518327638651c0 (diff)
updated maps.html to use google maps v3 and created custom route model using gmaps polyline tools to encode points
Diffstat (limited to 'apps/locations/admin.py')
-rw-r--r--apps/locations/admin.py55
1 files changed, 54 insertions, 1 deletions
diff --git a/apps/locations/admin.py b/apps/locations/admin.py
index 77d1bb3..a23ef28 100644
--- a/apps/locations/admin.py
+++ b/apps/locations/admin.py
@@ -1,6 +1,6 @@
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
-from locations.models import Region,Country,Location,State
+from locations.models import Region,Country,Location,State,Route
from django.contrib import databrowse
from django.contrib.gis.maps.google import GoogleMap
from django.conf import settings
@@ -240,3 +240,56 @@ class LocationAdmin(OSMGeoAdmin):
# associating the Options with the actual model
admin.site.register(Location,LocationAdmin)
+class RouteAdmin(OSMGeoAdmin):
+ # Standard Django Admin Options
+ list_display = ('name','slug',)
+ prepopulated_fields = {'slug': ('name',)}
+ search_fields = ('name',)
+ ordering = ('name',)
+ save_as = True
+ search_fields = ['name',]
+ list_select_related = True
+ fieldsets = (
+ ('Location', {'fields': ('name','slug','pub_date','template_var_name','zoom'), 'classes': ('show','extrapretty')}),
+ ('Editable Map View', {'fields': ('geometry',), 'classes': ('show', 'wide')}),
+ )
+ extra_js = [GMAP.api_url + GMAP.key]
+ map_template = 'gis/admin/google.html'
+ # Default GeoDjango OpenLayers map options
+ # Uncomment and modify as desired
+ # To learn more about this jargon visit:
+ # www.openlayers.org
+
+ #default_lon = 0
+ #default_lat = 0
+ #default_zoom = 4
+ #display_wkt = False
+ #display_srid = False
+ #extra_js = []
+ #num_zoom = 18
+ #max_zoom = False
+ #min_zoom = False
+ #units = False
+ #max_resolution = False
+ #max_extent = False
+ #modifiable = True
+ #mouse_position = True
+ #scale_text = True
+ #layerswitcher = True
+ scrollable = False
+ #admin_media_prefix = settings.ADMIN_MEDIA_PREFIX
+ map_width = 700
+ map_height = 325
+ #map_srid = 4326
+ #map_template = 'gis/admin/openlayers.html'
+ #openlayers_url = 'http://openlayers.org/api/2.6/OpenLayers.js'
+ #wms_url = 'http://labs.metacarta.com/wms/vmap0'
+ #wms_layer = 'basic'
+ #wms_name = 'OpenLayers WMS'
+ #debug = False
+ #widget = OpenLayersWidget
+
+# Finally, with these options set now register the model
+# associating the Options with the actual model
+admin.site.register(Route,RouteAdmin)
+