Changes between Initial Version and Version 2 of Ticket #21236


Ignore:
Timestamp:
Oct 6, 2013, 7:24:13 PM (11 years ago)
Author:
Simon Charette
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21236 – Description

    initial v2  
    11This occurs when trying to apply a migration that contains a single modification: the application of a unique_together constraint.  full traceback at the end, but the problem seems to come around here:
    22
     3{{{
    34    self.create_model(temp_model)
    45  File "/workspace/virtualenv/lib/python3.3/site-packages/django/db/backends/schema.py", line 225, in create_model
     
    78    % (self.object_name, name))
    89django.db.models.fields.FieldDoesNotExist: Item has no field named 'l'
     10}}}
    911
    10 Context: this is a model whose unique_together constraint is on its only two fields, which in this case are called
    11 "list" and "item":
    12 
     12Context: this is a model whose unique_together constraint is on its only two fields, which in this case are called `list` and `item`:
     13{{{#!python
    1314        migrations.AlterUniqueTogether(
    1415            unique_together = set(['text', 'list']),
    1516            name = 'item',
    1617        ),
    17 
     18}}}
    1819
    1920I did a little digging. Inside the 'schema.py', in the `create_model` function, a little debug print like this:
    2021
    21  print('unique_together', model._meta.unique_together)
     22{{{#!python
     23 print('unique_together', model._meta.unique_together)
     24}}}
    2225
    2326gives
    2427
     28{{{#!python
    2529unique_together [('l', 'i', 's', 't'), ('t', 'e', 'x', 't')]
     30}}}
    2631
    2732Looks like some list comprehension somewhere has gone wrong?
     
    3742then just cd into myproject, run python manage.py syncdb, and you should get:
    3843
     44{{{
    3945$ python manage.py syncdb
    4046Operations to perform:
     
    8490    % (self.object_name, name))
    8591django.db.models.fields.FieldDoesNotExist: Item has no field named 't'
    86 
     92}}}
    8793
    8894Full trac
     95{{{
    8996/home/harry/Dropbox/book/source/chapter_09/virtualenv/lib/python3.3/site-packages/django/db/backends/schema.py
    9097
     
    136143    % (self.object_name, name))
    137144django.db.models.fields.FieldDoesNotExist: Item has no field named 't'
     145}}}
Back to Top