Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
Has patch:  1|  checkin
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by Simon Charette ):

 In [changeset:"99f3a65c730f643d35d959aa9a693101b2d21efd"]:
 {{{
 #!CommitTicketReference repository=""
 revision="99f3a65c730f643d35d959aa9a693101b2d21efd"
 [1.7.x] Fixed a MySQL test failure introduced by cbb29af1aa.

 Seems like unlike other backends MySQL get_constraints fails when dealing
 with a non-existing table. refs #23160.

 Backport of 1b00738f73 from master
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.8c5a5bc09bc2f829a646c0f6bdc97dde%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
Has patch:  1|  checkin
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by Simon Charette ):

 In [changeset:"6b2473d3e8048158dbc8c886d755cbf948325077"]:
 {{{
 #!CommitTicketReference repository=""
 revision="6b2473d3e8048158dbc8c886d755cbf948325077"
 [1.7.x] Fixed #23160 -- Correctly rename models with self referential
 fields.

 Thanks to whitews AT gmail for the report.

 Backport of cbb29af1aa from master
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.9bdd5cf9d1bff0d5d72ac8a040d6ce29%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
Has patch:  1|  checkin
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by Simon Charette ):

 In [changeset:"1b00738f73444693dd94958f3fc53c089f4d96e7"]:
 {{{
 #!CommitTicketReference repository=""
 revision="1b00738f73444693dd94958f3fc53c089f4d96e7"
 Fixed a MySQL test failure introduced by cbb29af1aa.

 Seems like unlike other backends MySQL get_constraints fails when dealing
 with a non-existing table. refs #23160.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.be510cdfc21b38863e379b17347273af%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
Has patch:  1|  checkin
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by Simon Charette ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"cbb29af1aa1ebe11b38e73a6f34df9cd171d6c5b"]:
 {{{
 #!CommitTicketReference repository=""
 revision="cbb29af1aa1ebe11b38e73a6f34df9cd171d6c5b"
 Fixed #23160 -- Correctly rename models with self referential fields.

 Thanks to whitews AT gmail for the report.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.f4970ed07599d6d1574354c3816bfd71%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Ready for
Has patch:  1|  checkin
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by charettes):

 * stage:  Accepted => Ready for checkin


Comment:

 Marking RFC per Florian's comment on IRC. Will just wait for the CI build
 to complete and I'll merge/backport to 1.7.x.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.f39b516de36c95a63515877ffcd6ef8e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by anonymous):

 Verified the PR from charettes fixes the issue. Thanks!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.37da61e614fb4d39cc516d4da99832e1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+-
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by charettes):

 * has_patch:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 Created a [https://github.com/django/django/pull/3012 PR with tests].

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.44581bcdcf9bd6bd7f002d1bf5f2289b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+--
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

Comment (by bmispelon):

 Same here.

 For what it's worth, you can trigger the error with one simple model:
 {{{#!python
 class Foo(models.Model):
 parent = models.ForeignKey('self')
 }}}

 Renaming that model to `Bar` and running `makemigrations` works: the
 autodetector asks if the model was renamed.
 However, running `migrate` after that fails with the reported `KeyError`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.93d4053998f2250165fd4adde58a7661%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
-+--
 Reporter:  whitews@…|Owner:  charettes
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-rc-2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by charettes):

 * status:  new => assigned
 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * owner:  nobody => charettes
 * needs_docs:   => 0
 * severity:  Normal => Release blocker


Old description:

> I'm simply trying to rename a model which has a relationship to itself.
> Running the RenameModel operation yields the following traceback:
>
> $ python manage.py migrate myapp
> Operations to perform:
>   Apply all migrations: myapp
> Running migrations:
>   Applying myapp.0002_rename_Foo_to_Bar...Traceback (most recent call
> last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/core/management/__init__.py", line
> 385, in execute_from_command_line
> utility.execute()
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/core/management/__init__.py", line
> 377, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/core/management/base.py", line
> 288, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/core/management/base.py", line
> 338, in execute
> output = self.handle(*args, **options)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/core/management/commands/migrate.py",
> line 160, in handle
> executor.migrate(targets, plan, fake=options.get("fake", False))
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/executor.py", line
> 63, in migrate
> self.apply_migration(migration, fake=fake)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/executor.py", line
> 91, in apply_migration
> if self.detect_soft_applied(migration):
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/executor.py", line
> 134, in detect_soft_applied
> project_state = self.loader.project_state((migration.app_label,
> migration.name), at_end=True)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/loader.py", line
> 268, in project_state
> return self.graph.make_state(nodes=nodes, at_end=at_end,
> real_apps=list(self.unmigrated_apps))
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/graph.py", line 147,
> in make_state
> project_state = self.nodes[node].mutate_state(project_state)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/migration.py", line
> 76, in mutate_state
> operation.state_forwards(self.app_label, new_state)
>   File "/usr/local/lib/python2.7/dist-
> packages/Django-1.7c2-py2.7.egg/django/db/migrations/operations/models.py",
> line 132, in state_forwards
> for name, field in state.models[related_key].fields:
> KeyError: ('myapp', 'foo')

New description:

 I'm simply trying to rename a model which has a relationship to itself.
 Running the RenameModel operation yields the following traceback:

 {{{
 $ python manage.py migrate myapp
 Operations to perform:
   Apply all migrations: myapp
 Running migrations:
   Applying myapp.0002_rename_Foo_to_Bar...Traceback (most recent call
 last):
   File "manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/__init__.py", line
 385, in execute_from_command_line
 utility.execute()
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/__init__.py", line
 377, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/base.py", line 288,
 in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/base.py", line 338,
 in execute
 output = 

[Django] #23160: KeyError when performing a RenameModel migration operation for a model with self-referential FK field

2014-08-03 Thread Django
#23160: KeyError when performing a RenameModel migration operation for a model 
with
self-referential FK field
+--
 Reporter:  whitews@…   |  Owner:  nobody
 Type:  Bug | Status:  new
Component:  Migrations  |Version:  1.7-rc-2
 Severity:  Normal  |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0   |  UI/UX:  0
+--
 I'm simply trying to rename a model which has a relationship to itself.
 Running the RenameModel operation yields the following traceback:

 $ python manage.py migrate myapp
 Operations to perform:
   Apply all migrations: myapp
 Running migrations:
   Applying myapp.0002_rename_Foo_to_Bar...Traceback (most recent call
 last):
   File "manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/__init__.py", line
 385, in execute_from_command_line
 utility.execute()
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/__init__.py", line
 377, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/base.py", line 288,
 in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/base.py", line 338,
 in execute
 output = self.handle(*args, **options)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/core/management/commands/migrate.py",
 line 160, in handle
 executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/executor.py", line
 63, in migrate
 self.apply_migration(migration, fake=fake)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/executor.py", line
 91, in apply_migration
 if self.detect_soft_applied(migration):
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/executor.py", line
 134, in detect_soft_applied
 project_state = self.loader.project_state((migration.app_label,
 migration.name), at_end=True)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/loader.py", line 268,
 in project_state
 return self.graph.make_state(nodes=nodes, at_end=at_end,
 real_apps=list(self.unmigrated_apps))
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/graph.py", line 147,
 in make_state
 project_state = self.nodes[node].mutate_state(project_state)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/migration.py", line
 76, in mutate_state
 operation.state_forwards(self.app_label, new_state)
   File "/usr/local/lib/python2.7/dist-
 packages/Django-1.7c2-py2.7.egg/django/db/migrations/operations/models.py",
 line 132, in state_forwards
 for name, field in state.models[related_key].fields:
 KeyError: ('myapp', 'foo')

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/060.a65893fa69049aca08bb5e47ac7d3b8b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.