[1.7.x] Factorized create_index_sql expression

Backport of 6072f17d0 from master, with one test reinforced.
I find this style a bit more readable, up to you though.
```
self.assertIn(
    connection.ops.quote_name(
        editor._create_index_name(Article, ['headline', 'pub_date'], suffix='_idx')
    ),
    index_sql[0]
)
```

For a release note, I suggest:
```
* Added quoting to field indexes in the SQL generated by migrations to prevent
  a crash when the index name requires it :ticket:`#24015`.
```
Also add "Fixed #....." in the commit message?