Opened 9 years ago

Last modified 9 years ago

#25384 closed Cleanup/optimization

New Migrations Generated with Improperly Sorted Imports — at Version 7

Reported by: jambonrose Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Markus Holtermann)

New migration files are generated with the following line of code (found in the django/db/migrations/writer.py file):

    from django.db import models, migrations

Anytime isort is run on a migration file (for example, for data migrations), it will reorder the import to:

    from django.db import migrations, models

It would be great if we were generating properly sorted documents.

Change History (7)

comment:1 by Maxime Lorant, 9 years ago

Description: modified (diff)

comment:2 by Collin Anderson, 9 years ago

Hi, could you try this out on master (1.9)? I think it _may_ have been fixed already.

comment:3 by jambonrose, 9 years ago

Argh. Collin is right. I was looking at this on the wrong branch. Very sorry.

comment:4 by jambonrose, 9 years ago

Resolution: invalid
Status: newclosed

comment:5 by Tim Graham, 9 years ago

Resolution: invalidduplicate

(done in #24155)

comment:6 by Markus Holtermann, 9 years ago

Resolution: duplicate
Status: closednew
Triage Stage: UnreviewedAccepted

As briefly discussed on IRC the other day, I add a patch for 1.8 to change the order of those two imports. It's annoying to change the order manually.

The issue is indeed fixed on master.

comment:7 by Markus Holtermann, 9 years ago

Description: modified (diff)
Has patch: set
Note: See TracTickets for help on using tickets.
Back to Top