#25384 closed Cleanup/optimization (fixed)
New Migrations Generated with Improperly Sorted Imports
| 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 )
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 (9)
comment:1 by , 10 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Argh. Collin is right. I was looking at this on the wrong branch. Very sorry.
comment:4 by , 10 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:6 by , 10 years ago
| Resolution: | duplicate |
|---|---|
| Status: | closed → new |
| Triage Stage: | Unreviewed → Accepted |
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 , 10 years ago
| Description: | modified (diff) |
|---|---|
| Has patch: | set |
Hi, could you try this out on master (1.9)? I think it _may_ have been fixed already.