mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Refs #34140 -- Corrected rst code-block and various formatting issues in docs.
This commit is contained in:
parent
c67ea79aa9
commit
ba755ca131
57 changed files with 443 additions and 269 deletions
|
@ -722,6 +722,8 @@ subclass::
|
|||
like::
|
||||
|
||||
@admin.display(ordering='-first_name')
|
||||
def colored_first_name(self):
|
||||
...
|
||||
|
||||
The ``ordering`` argument supports query lookups to sort by values on
|
||||
related models. This example includes an "author first name" column in
|
||||
|
@ -752,7 +754,8 @@ subclass::
|
|||
def full_name(self):
|
||||
return self.first_name + ' ' + self.last_name
|
||||
|
||||
* Elements of ``list_display`` can also be properties::
|
||||
* Elements of ``list_display`` can also be properties
|
||||
::
|
||||
|
||||
class Person(models.Model):
|
||||
first_name = models.CharField(max_length=50)
|
||||
|
@ -2993,9 +2996,9 @@ returns a site instance.
|
|||
:caption: ``myproject/settings.py``
|
||||
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
# ...
|
||||
'myproject.apps.MyAdminConfig', # replaces 'django.contrib.admin'
|
||||
...
|
||||
# ...
|
||||
]
|
||||
|
||||
.. _multiple-admin-sites:
|
||||
|
|
|
@ -139,7 +139,7 @@ Geometry Lookups
|
|||
Geographic queries with geometries take the following general form (assuming
|
||||
the ``Zipcode`` model used in the :doc:`model-api`):
|
||||
|
||||
.. code-block:: pycon
|
||||
.. code-block:: text
|
||||
|
||||
>>> qs = Zipcode.objects.filter(<field>__<lookup_type>=<parameter>)
|
||||
>>> qs = Zipcode.objects.exclude(...)
|
||||
|
@ -175,7 +175,7 @@ band index can be specified.
|
|||
This results in the following general form for lookups involving rasters
|
||||
(assuming the ``Elevation`` model used in the :doc:`model-api`):
|
||||
|
||||
.. code-block:: pycon
|
||||
.. code-block:: text
|
||||
|
||||
>>> qs = Elevation.objects.filter(<field>__<lookup_type>=<parameter>)
|
||||
>>> qs = Elevation.objects.filter(<field>__<band_index>__<lookup_type>=<parameter>)
|
||||
|
|
|
@ -1007,15 +1007,15 @@ Coordinate System Objects
|
|||
>>> proj = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs '
|
||||
>>> wgs84 = SpatialReference(proj) # PROJ string
|
||||
>>> wgs84 = SpatialReference("""GEOGCS["WGS 84",
|
||||
DATUM["WGS_1984",
|
||||
SPHEROID["WGS 84",6378137,298.257223563,
|
||||
AUTHORITY["EPSG","7030"]],
|
||||
AUTHORITY["EPSG","6326"]],
|
||||
PRIMEM["Greenwich",0,
|
||||
AUTHORITY["EPSG","8901"]],
|
||||
UNIT["degree",0.01745329251994328,
|
||||
AUTHORITY["EPSG","9122"]],
|
||||
AUTHORITY["EPSG","4326"]]""") # OGC WKT
|
||||
... DATUM["WGS_1984",
|
||||
... SPHEROID["WGS 84",6378137,298.257223563,
|
||||
... AUTHORITY["EPSG","7030"]],
|
||||
... AUTHORITY["EPSG","6326"]],
|
||||
... PRIMEM["Greenwich",0,
|
||||
... AUTHORITY["EPSG","8901"]],
|
||||
... UNIT["degree",0.01745329251994328,
|
||||
... AUTHORITY["EPSG","9122"]],
|
||||
... AUTHORITY["EPSG","4326"]]""") # OGC WKT
|
||||
|
||||
.. method:: __getitem__(target)
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ Coordinate System Objects
|
|||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
|
||||
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]'
|
||||
>>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
|
||||
>>> print(srs['GEOGCS'])
|
||||
WGS 84
|
||||
|
|
|
@ -702,11 +702,13 @@ Distance Lookups
|
|||
For an overview on performing distance queries, please refer to
|
||||
the :ref:`distance queries introduction <distance-queries>`.
|
||||
|
||||
Distance lookups take the following form::
|
||||
Distance lookups take the following form:
|
||||
|
||||
<field>__<distance lookup>=(<geometry/raster>, <distance value>[, 'spheroid'])
|
||||
<field>__<distance lookup>=(<raster>, <band_index>, <distance value>[, 'spheroid'])
|
||||
<field>__<band_index>__<distance lookup>=(<raster>, <band_index>, <distance value>[, 'spheroid'])
|
||||
.. code-block:: text
|
||||
|
||||
<field>__<distance lookup>=(<geometry/raster>, <distance value>[, "spheroid"])
|
||||
<field>__<distance lookup>=(<raster>, <band_index>, <distance value>[, "spheroid"])
|
||||
<field>__<band_index>__<distance lookup>=(<raster>, <band_index>, <distance value>[, "spheroid"])
|
||||
|
||||
The value passed into a distance lookup is a tuple; the first two
|
||||
values are mandatory, and are the geometry to calculate distances to,
|
||||
|
|
|
@ -822,7 +822,7 @@ Other Properties & Methods
|
|||
.. code-block:: pycon
|
||||
|
||||
>>> if poly_1.area > poly_2.area:
|
||||
>>> pass
|
||||
... pass
|
||||
|
||||
.. _geos-geometry-collections:
|
||||
|
||||
|
|
|
@ -70,9 +70,10 @@ Example
|
|||
|
||||
>>> from django.contrib.gis.utils import LayerMapping
|
||||
>>> from geoapp.models import TestGeo
|
||||
>>> mapping = {'name' : 'str', # The 'name' model field maps to the 'str' layer field.
|
||||
'poly' : 'POLYGON', # For geometry fields use OGC name.
|
||||
} # The mapping is a dictionary
|
||||
>>> mapping = {
|
||||
... 'name': 'str', # The 'name' model field maps to the 'str' layer field.
|
||||
... 'poly': 'POLYGON', # For geometry fields use OGC name.
|
||||
... } # The mapping is a dictionary
|
||||
>>> lm = LayerMapping(TestGeo, 'test_poly.shp', mapping)
|
||||
>>> lm.save(verbose=True) # Save the layermap, imports the data.
|
||||
Saved: Name: 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue