  .. code-block:: pycon
  
      >>> from django.core.exceptions import ObjectDoesNotExist
      >>> try:
      >>>     p2.restaurant
      >>> except ObjectDoesNotExist:
      >>>     print("There is no restaurant here.")
      There is no restaurant here.
  
  You can also use ``hasattr`` to avoid the need for exception catching:
  
  .. code-block:: pycon
 
</s> remove         >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
 </s> add         >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]' </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 use the default_related_name ``bars``::
 </s> add use the default_related_name ``bars``:

.. code-block:: pycon </s> remove     >>> 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
 </s> add     >>> 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 </s> remove     >>>    'partition_by': [F('studio'), F('genre')],
    >>>    'order_by': 'released__year',
    >>> }
 </s> add     ...    'partition_by': [F('studio'), F('genre')],
    ...    'order_by': 'released__year',
    ... }
    ...     p2.restaurant
    ... except ObjectDoesNotExist:
    ...     print("There is no restaurant here.")
  .. code-block:: pycon
  
      >>> from django.core.exceptions import ObjectDoesNotExist
      >>> try:
    ...     p2.restaurant
    ... except ObjectDoesNotExist:
    ...     print("There is no restaurant here.")
    ...     p2.restaurant
    ... except ObjectDoesNotExist:
    ...     print("There is no restaurant here.")
    ...     p2.restaurant
    ... except ObjectDoesNotExist:
    ...     print("There is no restaurant here.")
      There is no restaurant here.
  
  You can also use ``hasattr`` to avoid the need for exception catching:
  
  .. code-block:: pycon
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/topics/db/examples/one_to_one.txt