summaryrefslogtreecommitdiff
path: root/app/locations/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations/admin.py')
-rw-r--r--app/locations/admin.py401
1 files changed, 168 insertions, 233 deletions
diff --git a/app/locations/admin.py b/app/locations/admin.py
index 5e6106b..6d971f1 100644
--- a/app/locations/admin.py
+++ b/app/locations/admin.py
@@ -1,297 +1,232 @@
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
-from locations.models import Region,Country,Location,State,Route
-
-from django.contrib.gis.maps.google import GoogleMap
+from locations.models import Region, Country, Location, State, Route
from django.conf import settings
-GMAP = GoogleMap(key=settings.GOOGLE_MAPS_API_KEY)
-
class RegionAdmin(OSMGeoAdmin):
- # Standard Django Admin Options
- list_display = ('name','slug')
+ list_display = ('name', 'slug')
prepopulated_fields = {'slug': ('name',)}
search_fields = ('name',)
ordering = ('name',)
save_as = True
- search_fields = ['name',]
+ search_fields = ['name']
list_select_related = True
fieldsets = (
- ('Region', {'fields': ('name','slug','pub_date'), 'classes': ('show','extrapretty')}),
- ('Editable Map View', {'fields': ('geometry',), 'classes': ('show', 'wide')}),
+ ('Region', {
+ 'fields': (
+ 'name',
+ 'slug',
+ 'pub_date'
+ ),
+ '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
+
+ # options for OSM map Using custom ESRI topo map
+ default_lon = -9285175
+ default_lat = 4025046
+ default_zoom = 6
+ units = 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
+ map_height = 425
+ map_template = 'gis/admin/osm.html'
+
+admin.site.register(Region, RegionAdmin)
-# Finally, with these options set now register the model
-# associating the Options with the actual model
-admin.site.register(Region,RegionAdmin)
class CountryAdmin(OSMGeoAdmin):
- """
- # Standard Django Admin Options
- list_display = ('name','slug','region')
- prepopulated_fields = {'slug': ('name',)}
- search_fields = ('name',)
- ordering = ('name',)
- save_as = True
- search_fields = ['name',]
- list_select_related = True
- fieldsets = (
- ('Country', {'fields': ('name','slug','abbr','region','pub_date'), 'classes': ('show','extrapretty')}),
- ('Editable Map View', {'fields': ('geometry',), 'classes': ('show', 'wide')}),
- )
- """
-
- # Standard Django Admin Options
- list_display = ('name','pop2005','region','subregion',)
+ list_display = ('name', 'pop2005', 'region', 'subregion')
search_fields = ('name',)
ordering = ('name',)
- list_filter = ('visited','region','subregion',)
+ list_filter = ('visited', 'region', 'subregion')
save_as = True
- search_fields = ['name','iso2','iso3','subregion','region']
+ search_fields = ['name', 'iso2', 'iso3', 'subregion', 'region']
list_select_related = True
fieldsets = (
- ('Country Attributes', {'fields': (('name','pop2005','slug','zoom_level','visited')), 'classes': ('show','extrapretty')}),
- ('Country Codes', {'fields': ('region','subregion','iso2','iso3','un',), 'classes': ('collapse',)}),
- ('Area and Coordinates', {'fields': ('area','lat','lon',), 'classes': ('collapse', 'wide')}),
- ('Editable Map View', {'fields': ('geometry',), 'classes': ('show', 'wide')}),
+ ('Country Attributes',
+ {'fields': (
+ 'name',
+ 'pop2005',
+ 'slug',
+ 'zoom_level',
+ 'visited'
+ ),
+ 'classes': (
+ 'show',
+ 'extrapretty'
+ )
+ }
+ ),
+ ('Country Codes',
+ {'fields': (
+ 'region',
+ 'subregion',
+ 'iso2',
+ 'iso3',
+ 'un',
+ ),
+ 'classes': ('collapse',)
+ }
+ ),
+ ('Area and Coordinates',
+ {'fields': (
+ 'area',
+ 'lat',
+ 'lon',
+ ),
+ 'classes': ('collapse', 'wide')
+ }
+ ),
+ ('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
+ # Options for OSM map Using custom ESRI topo map
+ default_lon = -9285175
+ default_lat = 4025046
+ default_zoom = 6
+ units = 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
+ map_height = 425
+ map_template = 'gis/admin/osm.html'
-# Finally, with these options set now register the model
-# associating the Options with the actual model
-admin.site.register(Country,CountryAdmin)
+admin.site.register(Country, CountryAdmin)
class StateAdmin(OSMGeoAdmin):
- # Standard Django Admin Options
- list_display = ('name','code','slug','country')
+ list_display = ('name', 'code', 'slug', 'country')
prepopulated_fields = {'slug': ('name',)}
- search_fields = ('name','country')
+ search_fields = ('name', 'country')
ordering = ('name',)
save_as = True
- search_fields = ['name',]
+ search_fields = ['name']
list_select_related = True
fieldsets = (
- ('Location', {'fields': ('name','slug','code','pub_date','country'), 'classes': ('show','extrapretty')}),
- ('Editable Map View', {'fields': ('geometry',), 'classes': ('show', 'wide')}),
+ ('Location',
+ {'fields': (
+ 'name',
+ 'slug',
+ 'code',
+ 'pub_date',
+ 'country'
+ ),
+ '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
+
+ # Options for OSM map Using custom ESRI topo map
+ default_lon = -9285175
+ default_lat = 4025046
+ default_zoom = 6
+ units = 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
+ map_height = 425
+ map_template = 'gis/admin/osm.html'
+
+admin.site.register(State, StateAdmin)
-# Finally, with these options set now register the model
-# associating the Options with the actual model
-admin.site.register(State,StateAdmin)
class LocationAdmin(OSMGeoAdmin):
- # Standard Django Admin Options
- list_display = ('name','slug','state')
+ list_display = ('name', 'slug', 'state')
prepopulated_fields = {'slug': ('name',)}
- search_fields = ('name','state')
+ search_fields = ('name', 'state')
ordering = ('name',)
save_as = True
- search_fields = ['name',]
+ search_fields = ['name']
list_select_related = True
fieldsets = (
- ('Location', {'fields': ('name','slug','pub_date','state'), 'classes': ('show','extrapretty')}),
- ('Editable Map View', {'fields': ('geometry',), 'classes': ('show', 'wide')}),
+ ('Location',
+ {'fields': (
+ 'name',
+ 'slug',
+ 'pub_date',
+ 'state'
+ ),
+ '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
+ # options for OSM map Using custom ESRI topo map
+ default_lon = -9285175
+ default_lat = 4025046
+ default_zoom = 6
+ units = 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
+ map_height = 425
+ map_template = 'gis/admin/osm.html'
+
+admin.site.register(Location, LocationAdmin)
-# Finally, with these options set now register the model
-# associating the Options with the actual model
-admin.site.register(Location,LocationAdmin)
class RouteAdmin(OSMGeoAdmin):
- # Standard Django Admin Options
- list_display = ('name','slug',)
+ list_display = ('name', 'slug')
prepopulated_fields = {'slug': ('name',)}
search_fields = ('name',)
ordering = ('name',)
save_as = True
- search_fields = ['name',]
+ 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')}),
+ ('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
+
+ # options for OSM map Using custom ESRI topo map
+ default_lon = -9285175
+ default_lat = 4025046
+ default_zoom = 6
+ units = 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)
-
-
+ map_height = 425
+ map_template = 'gis/admin/osm.html'
+admin.site.register(Route, RouteAdmin)