• 
      

    Store the field and attribute orders in the signatures and mutations.

    Review Request #9578 — Created Feb. 3, 2018 and submitted — Latest diff uploaded

    Information

    Django Evolution
    master
    2c09869...

    Reviewers

    Model signatures were storing fields in a standard dictionary, ignoring
    the order provided by the model. For actual evolution operations, the
    order doesn't matter at all, but this did lead to some model diffing
    showing unexpected orders ("field3" before "field2", for instance).

    The biggest problem had to do when working toward the Python 3 port. Our
    unit tests were working off the dictionary order, which was stable
    across Python 2, but changed (twice) in 3. This meant that most unit
    tests failed, since the generated order of fields and mutations were
    different from what was expected.

    We now retain sort orders for fields by storing field information in an
    OrderedDict. This lets diffing, mutations, and unit tests all work off
    the order shown in the model instead of whatever comes out of dictionary
    iteration. That does mean a lot of unit tests had to change, which is
    the bulk of the change, but it provides stability across all versions of
    Python.

    Unit tests pass for all supported versions of Django and all database
    types. Tested with Python 2.7 and (with upcoming changes) Python 3.4,
    3.5, and 3.6.