#24073: Deactivate translations instead of forcing 'en-us' in management 
commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by MarkusH):

 * status:  closed => new
 * has_patch:  1 => 0
 * resolution:  fixed =>


Comment:

 This causes a regression with lazy strings marked for lazy translation.

 If you check out https://github.com/MarkusH/django-ticket-
 triage/commit/54fddd35795f71fea34cf4a166a271f9277e3d19 and run migrate
 twice, the second time Django will complain that there are changes not
 reflected by the migrations.

 Some of
 
[https://github.com/django/django/blob/master/django/core/management/commands/migrate.py#L201
 those changes] are `AlterField` operations:

 {{{#!python
 ipdb> changes['conference'][0].operations
 [<AlterField  field=<django.db.models.fields.CharField: name>,
 preserve_default=True, model_name='audiencelevel', name='name'>,
 <AlterField  field=<django.db.models.fields.CharField: name>,
 preserve_default=True, model_name='location', name='name'>, <AlterField
 field=<django.db.models.fields.CharField: name>, preserve_default=True,
 model_name='section', name='name'>, <AlterField
 field=<django.db.models.fields.CharField: name>, preserve_default=True,
 model_name='sessionkind', name='name'>, <AlterField
 field=<django.db.models.fields.CharField: name>, preserve_default=True,
 model_name='track', name='name'>]
 }}}

 Inspecting `generate_altered_fields()` in the migration autodetector yield

 {{{#!python
 >
 
/home/markus/Coding/django/django/db/migrations/autodetector.py(853)generate_altered_fields()
     852                 import ipdb; ipdb.set_trace()  # TODO: debugger
 --> 853                 if (not isinstance(old_field,
 models.ManyToManyField) and
     854                         not isinstance(new_field,
 models.ManyToManyField)):

 ipdb> old_field_dec
 ('django.db.models.PositiveSmallIntegerField', [], {'verbose_name':
 'action flag'})
 ipdb> new_field_dec
 ('django.db.models.PositiveSmallIntegerField', [], {'verbose_name':
 <django.utils.functional.lazy.<locals>.__proxy__ object at
 0x7f044e1e58d0>})
 }}}

 `git bisect` pin-points the change to
 f7c287fca9c9e6370cc88d1457d3ed9466703687

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:4>
Django <https://code.djangoproject.com/>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.80ac78aba20068d283c08d6a57976306%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to