Fix issues when the default id field is BigAutoField.

Review Request #14747 — Created Dec. 23, 2025 and updated

Information

Django Evolution
master

Reviewers

Django 6.0 changes the default type for automatically-added id fields to
use BigAutoField instead of AutoField. This change adds some compat
utilities to detect this, and updates tests to reflect the new types
that are used in this situation.

Ran unit tests.

Summary ID
Fix issues when the default id field is BigAutoField.
Django 6.0 changes the default type for automatically-added id fields to use `BigAutoField` instead of `AutoField`. This change adds some compat utilities to detect this, and updates tests to reflect the new types that are used in this situation. Testing Done: Ran unit tests.
yrsznrxrxrkustokpsrwtrukxmpnoomz
Description From Last Updated

Since we're supporting Python 3 only now, can you add typing for this?

chipx86chipx86

Same here.

chipx86chipx86

Somewhat food for thought here. Every time we call this, we do an import, and the results really aren't likely …

chipx86chipx86

Two blank lines here.

chipx86chipx86

This got indented incorrectly. Same with a whole bunch below.

chipx86chipx86

To avoid visual alignment differences, which matter for string expectations, I'd like to keep each line in a multi-line string …

chipx86chipx86
chipx86
  1. 
      
  2. django_evolution/compat/models.py (Diff revision 1)
     
     
    Show all issues

    Since we're supporting Python 3 only now, can you add typing for this?

    1. I'm going to add type annotations in future changes. For this one I'd like to match the surrounding style.

  3. django_evolution/compat/models.py (Diff revision 1)
     
     
    Show all issues

    Same here.

  4. django_evolution/compat/models.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Somewhat food for thought here.

    Every time we call this, we do an import, and the results really aren't likely to change. My first instinct is to just cache this result, and then clear it if we need to for testing purposes.

    1. No existing tests need to clear this. I'll just wrap it in caching, and if we need to override for tests we can use a spy.

  5. django_evolution/tests/db/postgresql.py (Diff revision 1)
     
     
     
     
    Show all issues

    Two blank lines here.

  6. django_evolution/tests/test_rename_field.py (Diff revision 1)
     
     
     
     
    Show all issues

    This got indented incorrectly. Same with a whole bunch below.

  7. django_evolution/tests/test_rename_field.py (Diff revision 1)
     
     
     
    Show all issues

    To avoid visual alignment differences, which matter for string expectations, I'd like to keep each line in a multi-line string prefixed with f in these cases.

  8. 
      
david
Review request changed
Commits:
Summary ID
Fix issues when the default id field is BigAutoField.
Django 6.0 changes the default type for automatically-added id fields to use `BigAutoField` instead of `AutoField`. This change adds some compat utilities to detect this, and updates tests to reflect the new types that are used in this situation. Testing Done: Ran unit tests.
yrsznrxrxrkustokpsrwtrukxmpnoomz
Fix issues when the default id field is BigAutoField.
Django 6.0 changes the default type for automatically-added id fields to use `BigAutoField` instead of `AutoField`. This change adds some compat utilities to detect this, and updates tests to reflect the new types that are used in this situation. Testing Done: Ran unit tests.
yrsznrxrxrkustokpsrwtrukxmpnoomz

Checks run (2 succeeded)

flake8 passed.
JSHint passed.