GeoDjango 的管理站点

GISModelAdmin

New in Django 4.0.
class GISModelAdmin
gis_widget

The widget class to be used for GeometryField. Defaults to OSMWidget.

gis_widget_kwargs

The keyword arguments that would be passed to the gis_widget. Defaults to an empty dictionary.

GeoModelAdmin

class GeoModelAdmin
default_lon

The default center longitude.

default_lat

The default center latitude.

default_zoom

The default zoom level to use. Defaults to 4.

extra_js

Sequence of URLs to any extra JavaScript to include.

map_template

Override the template used to generate the JavaScript slippy map. Default is 'gis/admin/openlayers.html'.

map_width

Width of the map, in pixels. Defaults to 600.

map_height

Height of the map, in pixels. Defaults to 400.

openlayers_url

Link to the URL of the OpenLayers JavaScript. Defaults to 'https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js'.

modifiable

Defaults to True. When set to False, disables editing of existing geometry fields in the admin.

注解

This is different from adding the geometry field to readonly_fields, which will only display the WKT of the geometry. Setting modifiable=False, actually displays the geometry in a map, but disables the ability to edit its vertices.

4.0 版后已移除: This class is deprecated. Use ModelAdmin instead.

OSMGeoAdmin

class OSMGeoAdmin

A subclass of GeoModelAdmin that uses a Spherical Mercator projection with OpenStreetMap street data tiles.

4.0 版后已移除: This class is deprecated. Use GISModelAdmin instead.