diff -r 382a03febff5 django/contrib/gis/admin/options.py
a
|
b
|
|
39 | 39 | debug = False |
40 | 40 | widget = OpenLayersWidget |
41 | 41 | |
42 | | def _media(self): |
| 42 | @property |
| 43 | def media(self): |
43 | 44 | "Injects OpenLayers JavaScript into the admin." |
44 | | media = super(GeoModelAdmin, self)._media() |
| 45 | media = super(GeoModelAdmin, self).media |
45 | 46 | media.add_js([self.openlayers_url]) |
46 | 47 | media.add_js(self.extra_js) |
47 | 48 | return media |
48 | | media = property(_media) |
49 | 49 | |
50 | 50 | def formfield_for_dbfield(self, db_field, **kwargs): |
51 | 51 | """ |
diff -r 382a03febff5 django/contrib/gis/tests/__init__.py
a
|
b
|
|
29 | 29 | |
30 | 30 | # The following GeoDjango test apps depend on GDAL support. |
31 | 31 | if HAS_GDAL: |
| 32 | # Geographic admin requires GDAL |
| 33 | apps.append('geoadmin') |
| 34 | |
32 | 35 | # 3D apps use LayerMapping, which uses GDAL. |
33 | 36 | if connection.ops.postgis and GEOS_PREPARE: |
34 | 37 | apps.append('geo3d') |
diff -r 382a03febff5 django/contrib/gis/tests/geoadmin/models.py
-
|
+
|
|
| 1 | from django.contrib.gis.db import models |
| 2 | from django.contrib.gis import admin |
| 3 | |
| 4 | class 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 | |
| 10 | admin.site.register(City, admin.OSMGeoAdmin) |
diff -r 382a03febff5 django/contrib/gis/tests/geoadmin/tests.py
-
|
+
|
|
| 1 | from django.test import TestCase |
| 2 | from django.contrib.gis import admin |
| 3 | from models import City |
| 4 | |
| 5 | class 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. |
diff -r 382a03febff5 django/contrib/gis/tests/geoadmin/urls.py
-
|
+
|
|
| 1 | from django.conf.urls.defaults import * |
| 2 | from django.contrib import admin |
| 3 | |
| 4 | urlpatterns = patterns('', |
| 5 | (r'^admin/', include(admin.site.urls)), |
| 6 | ) |