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

Description

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:

$ ./manage.py makemigrations
Migrations for 'indextg':
  0001_initial.py:
    - Create model A
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/base.py", 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/base.py", line 337, in execute
    output = self.handle(*args, **options)
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/commands/makemigrations.py", line 115, in handle
    self.write_migration_files(changes)
  File "/home/lucas/tmp/bug/venv/lib/python3.4/site-packages/django/core/management/commands/makemigrations.py", 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/models.py", line 291, in describe
    return "Alter %s for %s (%s constraints)" % (self.self.option_name, self.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