from django.db import models, migrations
Anytime [https://pypi.python.org/pypi/isort isort] is run on a migration
file (for example, for data migrations), it will reorder the import to:
from django.db import models, migrations
It would be great if we were generating properly sorted documents.
--
Ticket URL: <https://code.djangoproject.com/ticket/25384>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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 [https://pypi.python.org/pypi/isort isort] is run on a migration
> file (for example, for data migrations), it will reorder the import to:
>
> from django.db import models, migrations
>
> It would be great if we were generating properly sorted documents.
New description:
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 [https://pypi.python.org/pypi/isort 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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:1>
Comment (by collinanderson):
Hi, could you try this out on master (1.9)? I think it _may_ have been
fixed already.
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:2>
Comment (by jambonrose):
Argh. Collin is right. I was looking at this on the wrong branch. Very
sorry.
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:3>
* status: new => closed
* resolution: => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:4>
* resolution: invalid => duplicate
Comment:
(done in #24155)
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:5>
* status: closed => new
* resolution: duplicate =>
* stage: Unreviewed => Accepted
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:6>
* has_patch: 0 => 1
Old description:
> 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 [https://pypi.python.org/pypi/isort 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.
New description:
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 [https://pypi.python.org/pypi/isort 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.
--
Comment:
PR: https://github.com/django/django/pull/5274
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:7>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"3cc5cc79584b66dafac54264d072ac1206426471" 3cc5cc79]:
{{{
#!CommitTicketReference repository=""
revision="3cc5cc79584b66dafac54264d072ac1206426471"
[1.8.x] Fixed #25384 -- Ordered imports in newly created migration files
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:8>
Comment (by Markus Holtermann <info@…>):
In [changeset:"84b0a8d2aad042fb573df5055b6153770d0929ac" 84b0a8d]:
{{{
#!CommitTicketReference repository=""
revision="84b0a8d2aad042fb573df5055b6153770d0929ac"
Fixed #25384 -- Ordered imports in newly created migration files
Partial forwardport of 3cc5cc79584b66dafac54264d072ac1206426471 from
stable/1.8.x as the issue was already fixed in master in
a7bc00e17bebe34cdf23f744937b3c386ee73d81
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25384#comment:9>