2010-03-27 04:14:53 +08:00
|
|
|
.. _ref-gis-admin:
|
|
|
|
|
|
|
|
======================
|
|
|
|
GeoDjango's admin site
|
|
|
|
======================
|
|
|
|
|
|
|
|
.. module:: django.contrib.gis.admin
|
|
|
|
:synopsis: GeoDjango's extensions to the admin site.
|
|
|
|
|
|
|
|
|
|
|
|
``GeoModelAdmin``
|
|
|
|
=================
|
|
|
|
|
|
|
|
.. class:: GeoModelAdmin
|
|
|
|
|
|
|
|
.. attribute:: default_lon
|
|
|
|
|
|
|
|
The default center longitude.
|
|
|
|
|
|
|
|
.. attribute:: default_lat
|
|
|
|
|
|
|
|
The default center latitude.
|
|
|
|
|
|
|
|
.. attribute:: default_zoom
|
|
|
|
|
|
|
|
The default zoom level to use. Defaults to 18.
|
|
|
|
|
|
|
|
.. attribute:: extra_js
|
|
|
|
|
|
|
|
Sequence of URLs to any extra JavaScript to include.
|
|
|
|
|
|
|
|
.. attribute:: map_template
|
|
|
|
|
|
|
|
Override the template used to generate the JavaScript slippy map.
|
|
|
|
Default is ``'gis/admin/openlayers.html'``.
|
|
|
|
|
|
|
|
.. attribute:: map_width
|
|
|
|
|
|
|
|
Width of the map, in pixels. Defaults to 600.
|
|
|
|
|
|
|
|
.. attribute:: map_height
|
|
|
|
|
|
|
|
Height of the map, in pixels. Defaults to 400.
|
|
|
|
|
|
|
|
.. attribute:: openlayers_url
|
|
|
|
|
|
|
|
Link to the URL of the OpenLayers JavaScript. Defaults to
|
|
|
|
``'http://openlayers.org/api/2.8/OpenLayers.js'``.
|
|
|
|
|
2010-04-17 00:34:42 +08:00
|
|
|
|
|
|
|
.. attribute:: modifiable
|
|
|
|
|
|
|
|
Defaults to ``False``. When set to to ``True``, disables editing of
|
|
|
|
existing geometry fields in the admin.
|
|
|
|
|
|
|
|
.. note::
|
2010-08-20 03:27:44 +08:00
|
|
|
|
2010-04-17 00:34:42 +08:00
|
|
|
This is different from adding the geometry field to
|
|
|
|
:attr:`~django.contrib.admin.ModelAdmin.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.
|
|
|
|
|
2010-03-27 04:14:53 +08:00
|
|
|
``OSMGeoAdmin``
|
|
|
|
===============
|
|
|
|
|
|
|
|
.. class:: OSMGeoAdmin
|
|
|
|
|
|
|
|
A subclass of :class:`GeoModelAdmin` that uses a spherical mercator projection
|
2010-04-17 00:34:42 +08:00
|
|
|
with `OpenStreetMap <http://openstreetmap.org/>`_ street data tiles.
|
|
|
|
See the :ref:`OSMGeoAdmin introduction <osmgeoadmin-intro>`
|
2010-03-27 04:14:53 +08:00
|
|
|
in the tutorial for a usage example.
|