Re: [Django] #27750: TypeError when running manage.py migrate

2017-01-19 Thread Django
#27750: TypeError when running manage.py migrate
-+--
 Reporter:  Henrique Chehad  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.9
 Severity:  Normal   |   Resolution:  duplicate
 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 Tim Graham):

 * resolution:  needsinfo => duplicate


Comment:

 #24949 was to possibly implement an enhancement but at this point we're
 not going to spend time on Python 2 enhancements.

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


Re: [Django] #27750: TypeError when running manage.py migrate

2017-01-19 Thread Django
#27750: TypeError when running manage.py migrate
-+--
 Reporter:  Henrique Chehad  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.9
 Severity:  Normal   |   Resolution:  needsinfo
 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 Henrique Chehad):

 Thanks.

 The older migration file (0001_initial) that contains `artist` field was
 with bytestring. I edited it and now the `migrate` worked. It was
 affecting the current migration file (0005).

 {{{
 -('artist', models.ForeignKey(db_column=b'actor_id',
 on_delete=django.db.models.deletion.CASCADE, to='artists.Artist')),
 +('artist', models.ForeignKey(db_column='actor_id',
 on_delete=django.db.models.deletion.CASCADE, to='artists.Artist')),
 }}}


 Would be good a contribution with clearer error message or converting it
 before the `quote_name` function?


 Replying to [comment:1 Tim Graham]:
 > Did you follow the advice about
 [https://docs.djangoproject.com/en/1.10/topics/migrations/#supporting-
 python-2-and-3 supporting Python 2 and 3]? It looks like you might have a
 field in a migration that uses a bytestring (i.e. `b'artist'`). The issue
 is likely obsolete with the removal of Django's support for Python 2, but
 if you can reproduce some problem using only Python 3, please be more
 specific about the steps and provide a sample project. 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/072.ff0948af46e19d947c43f30f6c42dcab%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27750: TypeError when running manage.py migrate

2017-01-19 Thread Django
#27750: TypeError when running manage.py migrate
-+--
 Reporter:  Henrique Chehad  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.9
 Severity:  Normal   |   Resolution:  needsinfo
 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 Tim Graham):

 * status:  new => closed
 * type:  Uncategorized => Bug
 * resolution:   => needsinfo


Comment:

 Did you follow the advice about
 [https://docs.djangoproject.com/en/1.10/topics/migrations/#supporting-
 python-2-and-3 supporting Python 2 and 3]? It looks like you might have a
 field in a migration that uses a bytestring (i.e. `b'artist'`). The issue
 is likely obsolete with the removal of Django's support for Python 2, but
 if you can reproduce some problem using only Python 3, please be more
 specific about the steps and provide a sample project. 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/072.e542c04f276967a81c3d56fd58143418%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27750: TypeError when running manage.py migrate

2017-01-19 Thread Django
#27750: TypeError when running manage.py migrate
---+
   Reporter:  Henrique Chehad  |  Owner:  nobody
   Type:  Uncategorized| Status:  new
  Component:  Migrations   |Version:  1.9
   Severity:  Normal   |   Keywords:
   Triage Stage:  Unreviewed   |  Has patch:  0
Needs documentation:  0|Needs tests:  0
Patch needs improvement:  0|  Easy pickings:  0
  UI/UX:  0|
---+
 Hello,

 Is returning this error when I try to run ./manage.py migrate in a model:

 Model:

 {{{
 class Cast(models.Model):
 movie = models.ForeignKey("movies.Movie")
 artist = models.ForeignKey("artists.Artist", db_column="actor_id")
 }}}

 Migration:
 {{{
 migrations.AlterField(
 model_name='cast',
 name='artist',
 field=models.ForeignKey(db_column='actor_id',
 on_delete=django.db.models.deletion.CASCADE, to='artists.Artist'),
 ),
 }}}

 Error:

 {{{
 Traceback (most recent call last):
   File "manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File "/usr/local/lib/python3.5/site-
 packages/django/core/management/__init__.py", line 353, in
 execute_from_command_line
 utility.execute()
   File "/usr/local/lib/python3.5/site-
 packages/django/core/management/__init__.py", line 345, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/usr/local/lib/python3.5/site-
 packages/django/core/management/base.py", line 348, in run_from_argv
 self.execute(*args, **cmd_options)
   File "/usr/local/lib/python3.5/site-
 packages/raven/contrib/django/management/__init__.py", line 41, in
 new_execute
 return original_func(self, *args, **kwargs)
   File "/usr/local/lib/python3.5/site-
 packages/django/core/management/base.py", line 399, in execute
 output = self.handle(*args, **options)
   File "/usr/local/lib/python3.5/site-
 packages/django/core/management/commands/migrate.py", line 200, in handle
 executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/migrations/executor.py", line 92, in migrate
 self._migrate_all_forwards(plan, full_plan, fake=fake,
 fake_initial=fake_initial)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/migrations/executor.py", line 121, in
 _migrate_all_forwards
 state = self.apply_migration(state, migration, fake=fake,
 fake_initial=fake_initial)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/migrations/executor.py", line 198, in apply_migration
 state = migration.apply(state, schema_editor)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/migrations/migration.py", line 123, in apply
 operation.database_forwards(self.app_label, schema_editor, old_state,
 project_state)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/migrations/operations/fields.py", line 201, in
 database_forwards
 schema_editor.alter_field(from_model, from_field, to_field)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/backends/base/schema.py", line 482, in alter_field
 old_db_params, new_db_params, strict)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/backends/postgresql/schema.py", line 110, in
 _alter_field
 new_db_params, strict,
   File "/usr/local/lib/python3.5/site-
 packages/django/db/backends/base/schema.py", line 545, in _alter_field
 self.execute(self._rename_field_sql(model._meta.db_table, old_field,
 new_field, new_type))
   File "/usr/local/lib/python3.5/site-
 packages/django/db/backends/base/schema.py", line 867, in
 _rename_field_sql
 "old_column": self.quote_name(old_field.column),
   File "/usr/local/lib/python3.5/site-
 packages/django/db/backends/base/schema.py", line 113, in quote_name
 return self.connection.ops.quote_name(name)
   File "/usr/local/lib/python3.5/site-
 packages/django/db/backends/postgresql/operations.py", line 95, in
 quote_name
 if name.startswith('"') and name.endswith('"'):
 TypeError: startswith first arg must be bytes or a tuple of bytes, not str
 }}}

 The error is in the field `artist` of `Cast` model, because I added a
 `print()` to discover what is the field with the error when call the
 function `quote_name` and printed `actor_id`. I commented this field in
 migration just to test and worked.

 Detail: I didn't changed anything in this fields, it's because when I
 migrated from Python 2.7.5 to Python 3.5 the verbose_name changed (removed
 the u"") and asked to generate new migrations. I think it is unnecessary.

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

-- 
You received this