Changes between Version 2 and Version 4 of Ticket #21236


Ignore:
Timestamp:
Oct 6, 2013, 10:23:29 PM (11 years ago)
Author:
Simon Charette
Comment:

I'm not that familiar with the migration infrastructure yet but did you create that migrations.AlterUniqueTogether instance yourself or was it generated by django?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21236 – Description

    v2 v4  
    1010}}}
    1111
    12 Context: this is a model whose unique_together constraint is on its only two fields, which in this case are called `list` and `item`:
     12Context: this is a model whose unique_together constraint is on its only two fields, which in this case are called `list` and `text`:
    1313{{{#!python
    1414        migrations.AlterUniqueTogether(
     
    9191django.db.models.fields.FieldDoesNotExist: Item has no field named 't'
    9292}}}
    93 
    94 Full trac
    95 {{{
    96 /home/harry/Dropbox/book/source/chapter_09/virtualenv/lib/python3.3/site-packages/django/db/backends/schema.py
    97 
    98 
    99   Applying myapp.0002_auto...Traceback (most recent call last):
    100   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/models/options.py", line 381, in get_field_by_name
    101     return self._name_map[name]
    102 AttributeError: 'Options' object has no attribute '_name_map'
    103 
    104 During handling of the above exception, another exception occurred:
    105 
    106 Traceback (most recent call last):
    107   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/models/options.py", line 384, in get_field_by_name
    108     return cache[name]
    109 KeyError: 't'
    110 
    111 During handling of the above exception, another exception occurred:
    112 
    113 Traceback (most recent call last):
    114   File "manage.py", line 10, in <module>
    115     execute_from_command_line(sys.argv)
    116   File "/tmp/repro/venv/lib/python3.3/site-packages/django/core/management/__init__.py", line 397, in execute_from_command_line
    117     utility.execute()
    118   File "/tmp/repro/venv/lib/python3.3/site-packages/django/core/management/__init__.py", line 390, in execute
    119     self.fetch_command(subcommand).run_from_argv(self.argv)
    120   File "/tmp/repro/venv/lib/python3.3/site-packages/django/core/management/base.py", line 242, in run_from_argv
    121     self.execute(*args, **options.__dict__)
    122   File "/tmp/repro/venv/lib/python3.3/site-packages/django/core/management/base.py", line 289, in execute
    123     output = self.handle(*args, **options)
    124   File "/tmp/repro/venv/lib/python3.3/site-packages/django/core/management/commands/migrate.py", line 124, in handle
    125     executor.migrate(targets, plan, fake=options.get("fake", False))
    126   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/migrations/executor.py", line 60, in migrate
    127     self.apply_migration(migration, fake=fake)
    128   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/migrations/executor.py", line 89, in apply_migration
    129     migration.apply(project_state, schema_editor)
    130   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/migrations/migration.py", line 92, in apply
    131     operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
    132   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/migrations/operations/models.py", line 126, in database_forwards
    133     getattr(new_model._meta, "unique_together", set()),
    134   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/backends/sqlite3/schema.py", line 131, in alter_unique_together
    135     self._remake_table(model, override_uniques=new_unique_together)
    136   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/backends/sqlite3/schema.py", line 55, in _remake_table
    137     self.create_model(temp_model)
    138   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/backends/schema.py", line 223, in create_model
    139     columns = [model._meta.get_field_by_name(field)[0].column for field in fields]
    140   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/backends/schema.py", line 223, in <listcomp>
    141     columns = [model._meta.get_field_by_name(field)[0].column for field in fields]
    142   File "/tmp/repro/venv/lib/python3.3/site-packages/django/db/models/options.py", line 387, in get_field_by_name
    143     % (self.object_name, name))
    144 django.db.models.fields.FieldDoesNotExist: Item has no field named 't'
    145 }}}
Back to Top