Re: [Django] #30035: many to many through table not recognisable in custom migration

2018-12-12 Thread Django
#30035: many to many through table not recognisable in custom migration
-+-
 Reporter:  jainmickey   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  2.0
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:  many to many,| Triage Stage:
  through|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

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


Comment:

 It's unfortunately impossible to determine if Django is at fault with the
 little details you provided so far.

 The fact that you mention writing a custom migration without providing it
 makes it likely that the issue lies there.

 Please note that simply adding a `through` to a `ManyToManyField` or
 manually adding an `AlterField` to add the through is not working yet
 #23034.

 If you have any details that proves that Django is at fault and that this
 report is not a duplicate of #23034 please provide them and reopen this
 issue.

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


Re: [Django] #30035: many to many through table not recognisable in custom migration

2018-12-12 Thread Django
#30035: many to many through table not recognisable in custom migration
-+-
 Reporter:  jainmickey   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  2.0
 Severity:  Normal   |   Resolution:
 Keywords:  many to many,| Triage Stage:
  through|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by jainmickey:

Old description:

> I have a model `A` having field `b` as many to many. I wanted to make `b`
> default through table's default id field to be UUID.
> If I do that using through table, the admin interface changes to Inline
> and I don't want that. So, I tried writing a custom migration to do that.
>
> If I am checking the default intermediate table using `apps.get_model` it
> exists but when I use the same table in migrations it gives me error:
>
> ```
> File "./manage.py", line 19, in 
> execute_from_command_line(sys.argv)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 371, in
> execute_from_command_line
> utility.execute()
>   File "/Users/mj/.virtualenvs/
> proj/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 365, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/core/management/base.py", line 288, in run_from_argv
> self.execute(*args, **cmd_options)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/core/management/base.py", line 335, in execute
> output = self.handle(*args, **options)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/core/management/commands/migrate.py", line 200, in handle
> fake_initial=fake_initial,
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/db/migrations/executor.py", line 117, in migrate
> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
> fake_initial=fake_initial)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/db/migrations/executor.py", line 147, in
> _migrate_all_forwards
> state = self.apply_migration(state, migration, fake=fake,
> fake_initial=fake_initial)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/db/migrations/executor.py", line 244, in apply_migration
> state = migration.apply(state, schema_editor)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/db/migrations/migration.py", line 112, in apply
> operation.state_forwards(self.app_label, project_state)
>   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
> packages/django/db/migrations/operations/fields.py", line 70, in
> state_forwards
> state.models[app_label,
> self.model_name_lower].fields.append((self.name, field))
> KeyError: ('app', 'A_b')
> ```

New description:

 I have a model `A` having field `b` as many to many. I wanted to make `b`
 default through table's default id field to be UUID.
 If I do that using through table, the admin interface changes to Inline
 and I don't want that. So, I tried writing a custom migration to do that.

 If I am checking the default intermediate table using `apps.get_model` it
 exists but when I use the same table in migrations it gives me error:

 {{{

 File "./manage.py", line 19, in 
 execute_from_command_line(sys.argv)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/__init__.py", line 371, in
 execute_from_command_line
 utility.execute()
   File "/Users/mj/.virtualenvs/
 proj/lib/python3.6/site-packages/django/core/management/__init__.py", line
 365, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/base.py", line 288, in run_from_argv
 self.execute(*args, **cmd_options)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/base.py", line 335, in execute
 output = self.handle(*args, **options)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/commands/migrate.py", line 200, in handle
 fake_initial=fake_initial,
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/db/migrations/executor.py", line 117, in migrate
 state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
 fake_initial=fake_initial)
   File 

[Django] #30035: many to many through table not recognisable in custom migration

2018-12-12 Thread Django
#30035: many to many through table not recognisable in custom migration
-+-
   Reporter: |  Owner:  nobody
  jainmickey |
   Type:  Bug| Status:  new
  Component: |Version:  2.0
  Migrations |   Keywords:  many to many,
   Severity:  Normal |  through
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 I have a model `A` having field `b` as many to many. I wanted to make `b`
 default through table's default id field to be UUID.
 If I do that using through table, the admin interface changes to Inline
 and I don't want that. So, I tried writing a custom migration to do that.

 If I am checking the default intermediate table using `apps.get_model` it
 exists but when I use the same table in migrations it gives me error:

 ```
 File "./manage.py", line 19, in 
 execute_from_command_line(sys.argv)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/__init__.py", line 371, in
 execute_from_command_line
 utility.execute()
   File "/Users/mj/.virtualenvs/
 proj/lib/python3.6/site-packages/django/core/management/__init__.py", line
 365, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/base.py", line 288, in run_from_argv
 self.execute(*args, **cmd_options)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/base.py", line 335, in execute
 output = self.handle(*args, **options)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/core/management/commands/migrate.py", line 200, in handle
 fake_initial=fake_initial,
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/db/migrations/executor.py", line 117, in migrate
 state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
 fake_initial=fake_initial)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/db/migrations/executor.py", line 147, in
 _migrate_all_forwards
 state = self.apply_migration(state, migration, fake=fake,
 fake_initial=fake_initial)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/db/migrations/executor.py", line 244, in apply_migration
 state = migration.apply(state, schema_editor)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/db/migrations/migration.py", line 112, in apply
 operation.state_forwards(self.app_label, project_state)
   File "/Users/mj/.virtualenvs/proj/lib/python3.6/site-
 packages/django/db/migrations/operations/fields.py", line 70, in
 state_forwards
 state.models[app_label,
 self.model_name_lower].fields.append((self.name, field))
 KeyError: ('app', 'A_b')
 ```

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