Ticket #9295: geoadminsite.diff

File geoadminsite.diff, 1.9 KB (added by jbronn, 16 years ago)
  • django/contrib/gis/admin/__init__.py

     
    11# Getting the normal admin routines, classes, and `site` instance.
    2 from django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL
     2from django.contrib.admin import autodiscover as _autodiscover, site as _site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL
    33
    44# Geographic admin options classes and widgets.
    55from django.contrib.gis.admin.options import GeoModelAdmin
    66from django.contrib.gis.admin.widgets import OpenLayersWidget
     7from django.contrib.gis.admin.sites import site, GeoAdminSite
    78
    89try:
    910    from django.contrib.gis.admin.options import OSMGeoAdmin
    1011    HAS_OSM = True
    1112except ImportError:
    1213    HAS_OSM = False
     14
     15def 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

     
     1from django.contrib.admin import AdminSite
     2
     3class 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.
     15site = GeoAdminSite()
Back to Top