Fixed #19543 -- implemented SimpleLazyObject.__repr__

Thanks to Florian Hahn for the patch
PEP8 cleanup of functional.py
Fixed minor warnings in tests.
Fixed #19951 -- Admin: Invalid model PK values shouldn't cause 500 status.

Avoid ValueError in admin when passing a string as PK for an inherited
model with an integer PK field.

Thanks ikks for the patch. See also #11191.
Added missing method in the dummy database backend.
Fixed #19997 -- Added custom EMPTY_VALUES to form fields

Thanks Loic Bistuer for the report and the patch.
Made transaction.managed a no-op and deprecated it.

enter_transaction_management() was nearly always followed by managed().

In three places it wasn't, but they will all be refactored eventually.
The "forced" keyword argument avoids introducing behavior changes until
then.

This is mostly backwards-compatible, except, of course, for managed
itself. There's a minor difference in _enter_transaction_management:
the top self.transaction_state now contains the new 'managed' state
rather than the previous one. Django doesn't access
self.transaction_state in _enter_transaction_management.
Added an API to control database-level autocommit.
Separated autocommit and isolation level handling for PostgreSQL.

Autocommit cannot be manipulated independently from an open connection.
This commit introduces a minor change in behavior: entering transaction
management forces opening a databasse connection. This shouldn't be
backwards incompatible in any practical use case.
Enabled autocommit for PostgreSQL.

For users who didn't activate autocommit in their database options, this
is backwards-incompatible in "non-managed" aka "auto" transaction state.
This state now uses database-level autocommit instead of ORM-level
autocommit.

Also removed the uses_autocommit feature which lost its purpose.
Stopped flipping the uses_savepoints feature at runtime.
Expressed the dirty flag handling logic in terms of autocommit.
Added BaseDatabaseWrapper.ensure_connection.

This API is useful because autocommit cannot be managed without an open
connection.
Removed _enter/_leave_transaction_management.

The goal is to make all databases share a common, autocommit-based,
implementation.
Enabled database-level autocommit for all backends.

This is mostly a documentation change.

It has the same backwards-incompatibility consequences as those
described for PostgreSQL in a previous commit.
Deprecated transaction.commit/rollback_unless_managed.

Since "unless managed" now means "if database-level autocommit",
committing or rolling back doesn't have any effect.

Restored transactional integrity in a few places that relied on
automatically-started transactions with a transitory API.
Removed superfluous code now that connections use autocommit by default.
Deprecated transaction.is_managed().

It's synchronized with the autocommit flag.
Moved standard SQL for savepoints in the base backend.

These methods are only called when uses_savepoints = True anyway.
Refactored implementation of savepoints.

Prepared for using savepoints within transactions in autocommit mode.