#30527: Problem with creating migrations for subclassed field changes
-------------------------------------+-------------------------------------
Reporter: wfehr | Owner: nobody
Type: Bug | Status: new
Component: Core | Version: 2.2
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
`makemigrations` gives out 'No changes detected' for changes on a sub-
subclass of CharField (only tested with this field).
When creating a field as seen below (DummyCharField), a new migration only
gets created if `kwargs['max_length'] = 255` is wrapped inside an `if`.
{{{#!python
class BaseDummyCharField(models.CharField):
def __init__(self, *args, **kwargs):
if 'max_length' not in kwargs:
kwargs['max_length'] = 64
super().__init__(*args, **kwargs)
class DummyCharField(BaseDummyCharField):
def __init__(self, *args, **kwargs):
# Without the if 'makemigrations' does not recognize changes.
# Previous max_length (in initial migration) is 64.
if 'max_length' not in kwargs:
kwargs['max_length'] = 255
super().__init__(*args, **kwargs)
class DummyModel(models.Model):
dummy = DummyCharField()
}}}
(Also reproducable in version 2.0.6, maybe others as well.)
--
Ticket URL: <https://code.djangoproject.com/ticket/30527>
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/048.e5786c1abc661b846057ffa9c2f09e9d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.