mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #25205 -- Removed doc references to deprecated GeoManager class.
This commit is contained in:
parent
7fa1dd8a80
commit
c9fb4f3c45
8 changed files with 42 additions and 48 deletions
|
@ -238,20 +238,14 @@ model to represent this data::
|
|||
lon = models.FloatField()
|
||||
lat = models.FloatField()
|
||||
|
||||
# GeoDjango-specific: a geometry field (MultiPolygonField), and
|
||||
# overriding the default manager with a GeoManager instance.
|
||||
# GeoDjango-specific: a geometry field (MultiPolygonField)
|
||||
mpoly = models.MultiPolygonField()
|
||||
objects = models.GeoManager()
|
||||
|
||||
# Returns the string representation of the model.
|
||||
def __str__(self): # __unicode__ on Python 2
|
||||
return self.name
|
||||
|
||||
Please note two important things:
|
||||
|
||||
1. The ``models`` module is imported from ``django.contrib.gis.db``.
|
||||
2. You must override the model's default manager with
|
||||
:class:`~django.contrib.gis.db.models.GeoManager` to perform spatial queries.
|
||||
Note that the ``models`` module is imported from ``django.contrib.gis.db``.
|
||||
|
||||
The default spatial reference system for geometry fields is WGS84 (meaning
|
||||
the `SRID`__ is 4326) -- in other words, the field coordinates are in
|
||||
|
@ -579,7 +573,6 @@ directly into the ``models.py`` of a GeoDjango application::
|
|||
lon = models.FloatField()
|
||||
lat = models.FloatField()
|
||||
geom = models.MultiPolygonField(srid=4326)
|
||||
objects = models.GeoManager()
|
||||
|
||||
# Auto-generated `LayerMapping` dictionary for WorldBorder model
|
||||
worldborders_mapping = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue