Opened 4 years ago

Closed 4 years ago

#22927 closed Uncategorized (duplicate)

Can't create migration when index together is used

Reported by: lvella Owned by: nobody
Component: Uncategorized Version: 1.7-rc-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


With python 3.4, if I have the following minimal model:

from django.db import models

class A(models.Model):
    a = models.IntegerField()
    b = models.IntegerField()

    class Meta:
        index_together = [('a', 'b')]

And try to make migrations:

$ ./ makemigrations
Migrations for 'indextg':
    - Create model A
Traceback (most recent call last):
  File "./", line 10, in <module>
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/", line 385, in execute_from_command_line
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/", line 377, in execute
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/", line 337, in execute
    output = self.handle(*args, **options)
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/commands/", line 115, in handle
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/commands/", line 131, in write_migration_files
    self.stdout.write("    - %s\n" % operation.describe())
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/db/migrations/operations/", line 291, in describe
    return "Alter %s for %s (%s constraints)" % (self.self.option_name,, len(self.index_together))
AttributeError: 'AlterIndexTogether' object has no attribute 'self'

Change History (1)

comment:1 Changed 4 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

Duplicate of #22917

Note: See TracTickets for help on using tickets.
Back to Top