#22030 closed Bug (fixed)
AttributeError: 'CharField' object has no attribute 'swappable_setting'
Reported by: | Baptiste Mispelon | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | 1.7-alpha-1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here's how to reproduce:
Create an app with a simple models.py
(and put it in settings.INSTALLED_APPS
):
from django.db import models class Foo(models.Model): pass
Run makemigrations
and then migrate
.
Then change the Foo
model to be:
class Foo(models.Model): foo = models.CharField(max_length=10, default='')
After that, running manage.py makemigrations
breaks with the following traceback:
Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "./django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "./django/core/management/__init__.py", line 419, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "./django/core/management/base.py", line 287, in run_from_argv self.execute(*args, **options.__dict__) File "./django/core/management/base.py", line 336, in execute output = self.handle(*args, **options) File "./django/core/management/commands/makemigrations.py", line 80, in handle changes = autodetector.changes(graph=loader.graph, trim_to_apps=app_labels or None) File "./django/db/migrations/autodetector.py", line 33, in changes changes = self._detect_changes() File "./django/db/migrations/autodetector.py", line 236, in _detect_changes swappable_setting = new_apps.get_model(app_label, model_name)._meta.get_field_by_name(field_name)[0].swappable_setting AttributeError: 'CharField' object has no attribute 'swappable_setting'
Breakage was introduced in commit 11c021336c8cb1c92be998f1a44c89a746275107.
Change History (5)
comment:1 by , 11 years ago
Version: | 1.6 → 1.7-alpha-1 |
---|
comment:2 by , 11 years ago
Has patch: | set |
---|
comment:3 by , 11 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:4 by , 11 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Failing test case and tentative fix there: https://github.com/django/django/pull/2270