Replaced HAS_SPATIAL_DB by testing database feature

Refs #22632. This should be the base for using more database
features to exclude specific backends in GIS tests.
Thanks Tim Graham for the review.
Fixed broken tests on Oracle after 5853c87a458f62ebd62d7809168355610de2570c.

Oracle doesn't have a `BEGIN` statement so the test would
fail.

Refs #23303
Fixed #21801 -- Documented SingleObjectMixin.get_context_data() requires the object attribute.
Removed unused imports.
Fixed #23316 -- Added datetime.time serialization in migrations.