Add better type support when generating evolution hints.

Review Request #11120 — Created Aug. 4, 2020 and submitted

Django Evolution

When generating hints for an evolution, we attempt to construct some
usable Python based on the values provided to the field. We've supported
some basic primitive types, as well as models, but with constraint
support we'll be needing more than that.

This change introduces enhanced type support in hints. It now checks if
it's working with an object containing a deconstruct method, which
Django uses for some types for exactly this purpose. Based on those
values, we can generate a string containing Python code for
re-constructing that object, recursively going into any arguments
passed to it and serializing/reconstructing those.

It also supports directly specifying a class as a parameter, and fixes a
bug with single-item tuples.

Unit tests pass.

Tested this with some upcoming unit tests that make use of these new
type capabilities.

Add better type support when generating evolution hints.
  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (7be54cc)