  .. code-block:: pycon
  
      >>> 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
      >>> lm = LayerMapping(TestGeo, 'test_poly.shp', mapping)
      >>> lm.save(verbose=True) # Save the layermap, imports the data.
      Saved: Name: 1
      Saved: Name: 2
      Saved: Name: 3
 
</s> remove     >>>     p2.restaurant
    >>> except ObjectDoesNotExist:
    >>>     print("There is no restaurant here.")
 </s> add     ...     p2.restaurant
    ... except ObjectDoesNotExist:
    ...     print("There is no restaurant here.") </s> remove         >>> file_data = {'img': SimpleUploadedFile('test.png', <file data>)}
 </s> add         >>> file_data = {'img': SimpleUploadedFile('test.png', b"file data")} </s> remove     >>>     avg_rating=Window(
    >>>         expression=Avg('rating'),
    >>>         partition_by=[F('studio'), F('genre')],
    >>>         order_by='released__year',
    >>>         frame=RowRange(start=-2, end=2),
    >>>     ),
    >>> )
 </s> add     ...     avg_rating=Window(
    ...         expression=Avg('rating'),
    ...         partition_by=[F('studio'), F('genre')],
    ...         order_by='released__year',
    ...         frame=RowRange(start=-2, end=2),
    ...     ),
    ... ) </s> remove     >>>     avg_rating=Window(
    >>>         expression=Avg('rating'),
    >>>         partition_by=[F('studio'), F('genre')],
    >>>         order_by='released__year',
    >>>     ),
    >>> )
 </s> add     ...     avg_rating=Window(
    ...         expression=Avg('rating'),
    ...         partition_by=[F('studio'), F('genre')],
    ...         order_by='released__year',
    ...     ),
    ... ) </s> remove         >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
 </s> add         >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]'
    >>> 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
  .. code-block:: pycon
  
      >>> 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
    >>> 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
      Saved: Name: 2
      Saved: Name: 3
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #34140 -- Corrected rst code-block and various formatting issues in docs. 
docs/ref/contrib/gis/layermapping.txt