Ticket #16790: 16790.2.diff

File 16790.2.diff, 2.6 KB (added by jbronn, 4 years ago)

Added test stub.

  • django/contrib/gis/admin/options.py

    diff -r 382a03febff5 django/contrib/gis/admin/options.py
    a b  
    3939    debug = False
    4040    widget = OpenLayersWidget
    4141
    42     def _media(self):
     42    @property
     43    def media(self):
    4344        "Injects OpenLayers JavaScript into the admin."
    44         media = super(GeoModelAdmin, self)._media()
     45        media = super(GeoModelAdmin, self).media
    4546        media.add_js([self.openlayers_url])
    4647        media.add_js(self.extra_js)
    4748        return media
    48     media = property(_media)
    4949
    5050    def formfield_for_dbfield(self, db_field, **kwargs):
    5151        """
  • django/contrib/gis/tests/__init__.py

    diff -r 382a03febff5 django/contrib/gis/tests/__init__.py
    a b  
    2929
    3030    # The following GeoDjango test apps depend on GDAL support.
    3131    if HAS_GDAL:
     32        # Geographic admin requires GDAL
     33        apps.append('geoadmin')
     34
    3235        # 3D apps use LayerMapping, which uses GDAL.
    3336        if connection.ops.postgis and GEOS_PREPARE:
    3437            apps.append('geo3d')
  • new file django/contrib/gis/tests/geoadmin/models.py

    diff -r 382a03febff5 django/contrib/gis/tests/geoadmin/models.py
    - +  
     1from django.contrib.gis.db import models
     2from django.contrib.gis import admin
     3
     4class City(models.Model):
     5    name = models.CharField(max_length=30)
     6    point = models.PointField()
     7    objects = models.GeoManager()
     8    def __unicode__(self): return self.name
     9
     10admin.site.register(City, admin.OSMGeoAdmin)
  • new file django/contrib/gis/tests/geoadmin/tests.py

    diff -r 382a03febff5 django/contrib/gis/tests/geoadmin/tests.py
    - +  
     1from django.test import TestCase
     2from django.contrib.gis import admin
     3from models import City
     4
     5class GeoAdminTest(TestCase):
     6    urls = 'django.contrib.gis.tests.geoadmin.urls'
     7
     8    def test01_ensure_geographic_media(self):
     9        geoadmin = admin.site._registry[City]
     10        # TODO: Ensure `geoadmin.media` has what we expect.
  • new file django/contrib/gis/tests/geoadmin/urls.py

    diff -r 382a03febff5 django/contrib/gis/tests/geoadmin/urls.py
    - +  
     1from django.conf.urls.defaults import *
     2from django.contrib import admin
     3
     4urlpatterns = patterns('',
     5    (r'^admin/', include(admin.site.urls)),
     6)
Back to Top