Ticket #9295: geoadminsite.diff
File geoadminsite.diff, 1.9 KB (added by , 16 years ago) |
---|
-
django/contrib/gis/admin/__init__.py
1 1 # Getting the normal admin routines, classes, and `site` instance. 2 from django.contrib.admin import autodiscover ,site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL2 from django.contrib.admin import autodiscover as _autodiscover, site as _site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL 3 3 4 4 # Geographic admin options classes and widgets. 5 5 from django.contrib.gis.admin.options import GeoModelAdmin 6 6 from django.contrib.gis.admin.widgets import OpenLayersWidget 7 from django.contrib.gis.admin.sites import site, GeoAdminSite 7 8 8 9 try: 9 10 from django.contrib.gis.admin.options import OSMGeoAdmin 10 11 HAS_OSM = True 11 12 except ImportError: 12 13 HAS_OSM = False 14 15 def autodiscover(): 16 """ 17 Overridden from the regular admin autodiscover so that the geographic 18 `site` instance may also use apps registered with the 'normal' admin 19 `site` instance. 20 """ 21 _autodiscover() 22 site._registry.update(_site._registry) -
django/contrib/gis/admin/sites.py
1 from django.contrib.admin import AdminSite 2 3 class GeoAdminSite(AdminSite): 4 5 def check_dependencies(self): 6 """ 7 Check if requirements are met if any OSMGeoAdmin option classes 8 were used. 9 """ 10 # TODO: Check GDAL version, PROJ.4 datum shifting files. 11 super(GeoAdminSite, self).check_dependencies() 12 13 # This global object represents the default geographic admin site. Users 14 # may instantiate `GeoAdminSite` for their own custom sites. 15 site = GeoAdminSite()