Re: [Django] #22833: 1.7 migrations can't delete codependent "through" models

2014-06-15 Thread Django
#22833: 1.7 migrations can't delete codependent "through" models
-+--
 Reporter:  mozumder@…   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7-beta-2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

Comment (by Andrew Godwin ):

 In [changeset:"13aa079941dcfd953ba03a83f55c8a14399d15c2"]:
 {{{
 #!CommitTicketReference repository=""
 revision="13aa079941dcfd953ba03a83f55c8a14399d15c2"
 [1.7.x] Fixed #22833: Autodetector not doing through mapping correctly
 }}}

-- 
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/081.ef062a788ea0ad5b4cb28ef2a7280c8f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22833: 1.7 migrations can't delete codependent "through" models

2014-06-15 Thread Django
#22833: 1.7 migrations can't delete codependent "through" models
-+--
 Reporter:  mozumder@…   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7-beta-2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Andrew Godwin ):

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


Comment:

 In [changeset:"f717ef083aac2e839a86de1bac02b95e5fd1a4b1"]:
 {{{
 #!CommitTicketReference repository=""
 revision="f717ef083aac2e839a86de1bac02b95e5fd1a4b1"
 Fixed #22833: Autodetector not doing through mapping correctly
 }}}

-- 
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/081.4b55858567d9bc79353ccc22f3e11af7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22833: 1.7 migrations can't delete codependent "through" models

2014-06-14 Thread Django
#22833: 1.7 migrations can't delete codependent "through" models
-+--
 Reporter:  mozumder@…   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  1.7-beta-2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by bmispelon):

 * needs_better_patch:   => 0
 * stage:  Unreviewed => Accepted
 * severity:  Normal => Release blocker
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Hi,

 I can indeed reproduce your issue with the following simplified models
 (the problem appears on `master` as well):
 {{{#!python
 from django.db import models

 class Foo(models.Model):
 bazes = models.ManyToManyField('Baz', through='Bar')


 class Bar(models.Model):
 foo = models.ForeignKey('Foo')
 baz = models.ForeignKey('Baz')


 class Baz(models.Model):
 pass
 }}}

 After running an initial `makemigrations && migrate`, I delete the first
 two models, then run `makemigrations` (which works, producing essentially
 the same migration as the one you describe). After that, running `migrate`
 triggers a `KeyError` like the one you reported.

 I'll bump the severity to `release blocker` since this use-case should be
 perfectly valid.

 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/081.63bfd78e1d7fc787c9811cc882eb047a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #22833: 1.7 migrations can't delete codependent "through" models

2014-06-13 Thread Django
#22833: 1.7 migrations can't delete codependent "through" models
+
 Reporter:  mozumder@…  |  Owner:  nobody
 Type:  Bug | Status:  new
Component:  Migrations  |Version:  1.7-beta-2
 Severity:  Normal  |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0   |  UI/UX:  0
+
 Hi,

 I'm using Django 1.7b4, and I'm testing the migrations.  I have this
 existing model in the database:


 {{{
 class BlocksList(Named, Ordered):
 blocks_list_assignments = models.ManyToManyField(
   Block,
   through='BlocksListAssignment'
   )
 family = models.ForeignKey(
 BlockFamily,
 verbose_name=_("Family Name"),
 null=True,
 blank=True,
 )
 def __str__(self):  # Python 3: def __str__(self):
 return self.name


 class BlocksListAssignment(Ordered):
 block = models.ForeignKey(Block)
 block_list = models.ForeignKey(BlocksList)
 def __str__(self):  # Python 3: def __str__(self):
 return self.block_list.name + ": %s" % self.block

 }}}

 I'm trying to delete this with the makemigrations/migrate command, with
 this in my migrations file:


 {{{
 migrations.DeleteModel(
 name='BlocksList',
 ),
 migrations.DeleteModel(
 name='BlocksListAssignment',
 ),

 }}}

 It looks like the co-dependencies prevent the migrations from deleting
 both models, because I constantly get:

 {{{

 Running migrations:
   Applying blocks.0014_auto_20140613_2227...Traceback (most recent call
 last):
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/apps/config.py", line 152, in get_model
 return self.models[model_name.lower()]
 KeyError: 'blockslistassignment'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/db/migrations/state.py", line 76, in render
 model = self.apps.get_model(lookup_model[0], lookup_model[1])
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/apps/registry.py", line 190, in get_model
 return self.get_app_config(app_label).get_model(model_name.lower())
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/apps/config.py", line 155, in get_model
 "App '%s' doesn't have a '%s' model." % (self.label, model_name))
 LookupError: App 'blocks' doesn't have a 'blockslistassignment' model.

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "./manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/core/management/__init__.py", line 427, in
 execute_from_command_line
 utility.execute()
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/core/management/__init__.py", line 419, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/core/management/base.py", line 288, in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/core/management/base.py", line 337, in execute
 output = self.handle(*args, **options)
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/core/management/commands/migrate.py", line 146, in
 handle
 executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/db/migrations/executor.py", line 62, in migrate
 self.apply_migration(migration, fake=fake)
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/db/migrations/executor.py", line 90, in
 apply_migration
 if self.detect_soft_applied(migration):
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/db/migrations/executor.py", line 134, in
 detect_soft_applied
 apps = project_state.render()
   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
 /site-packages/django/db/migrations/state.py", line 86, in render
 model=lookup_model,
 ValueError: Lookup failed for model referenced by field
 blocks.BlocksList.blocks_list_assignments: blocks.BlocksListAssignment

 }}}

 Anyways to get around this I have to recreate the database and start from
 fixtures.

 Do let me