Should migrations have their imports sorted?

64 views
Skip to first unread message

Raphael Michel

unread,
Jul 25, 2015, 6:54:40 PM7/25/15
to django-d...@googlegroups.com
Hello,

some time ago, Django started to use isort to make sure imports are
formatted and sorted consistently throughout the codebase. I like this
very much, so I started adopting this practice for my own codebases.

However, today I noticed that when Django generates a migration, the
imports in the outputted python file are not necessarily sorted,
causing my checks to fail. In my case it was about these imports:

-from django.db import models, migrations
+from django.db import migrations, models

I had a short look at the source code, but being a novice to the
django.db subtree, I had no idea where exactly to look and I wanted to
ask here: Is this something trivial to fix or is it something that
cannot be solved without changing things very deeply?

This is, of course, absolutely not important, if not completely
irrelevant. However, if it would be a really easy fix, it could be a
nice bonus feature.

Cheers,
Raphael

Tim Graham

unread,
Jul 25, 2015, 7:32:21 PM7/25/15
to Django developers (Contributions to Django itself), ma...@raphaelmichel.de
I think it's been addressed in 1.9 to at least some extent. See https://github.com/django/django/commit/7f20041bca43ca33f0a9617793f2af7ab07c3fab

Raphael Michel

unread,
Jul 26, 2015, 5:07:42 AM7/26/15
to Tim Graham, Django developers (Contributions to Django itself)
Am Sat, 25 Jul 2015 16:32:21 -0700 (PDT)
schrieb Tim Graham <timog...@gmail.com>:
> I think it's been addressed in 1.9 to at least some extent. See
> https://github.com/django/django/commit/7f20041bca43ca33f0a9617793f2af7ab07c3fab

Oh, I didn't find that. Wonderful, sorry for the noise :)

Raphael
Reply all
Reply to author
Forward
0 new messages