Opened 10 years ago
Closed 10 years ago
#24735 closed Bug (duplicate)
"manage.py makemigrations --noinput" asks for renaming of fields
Reported by: | Daniel Hahler | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am trying to use ./manage.py makemigrations --exit --dry-run --noinput
to detect if there are changes.
Although --noinput
is specified, it asks about a renamed field:
Did you rename model.foo to model.bar (a CharField)? [y/N] ^CTraceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "…/django18/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "…/django18/django/core/management/__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "…/django18/django/core/management/base.py", line 390, in run_from_argv self.execute(*args, **cmd_options) File "…/django18/django/core/management/base.py", line 441, in execute output = self.handle(*args, **options) File "…/django18/django/core/management/commands/makemigrations.py", line 125, in handle migration_name=self.migration_name, File "…/django18/django/db/migrations/autodetector.py", line 43, in changes changes = self._detect_changes(convert_apps, graph) File "…/django18/django/db/migrations/autodetector.py", line 183, in _detect_changes self.generate_renamed_fields() File "…/django18/django/db/migrations/autodetector.py", line 744, in generate_renamed_fields if self.questioner.ask_rename(model_name, rem_field_name, field_name, field): File "…/django18/django/db/migrations/questioner.py", line 168, in ask_rename field_instance.__class__.__name__), False) File "…/django18/django/db/migrations/questioner.py", line 80, in _boolean_input result = input("%s " % question) KeyboardInterrupt
I've also tried closing stdin via </dev/null
, but that results in another error:
File "/home/daniel/Vcs/django18/django/db/migrations/questioner.py", line 168, in ask_rename field_instance.__class__.__name__), False) File "/home/daniel/Vcs/django18/django/db/migrations/questioner.py", line 80, in _boolean_input result = input("%s " % question) EOFError: EOF when reading a line
Does it make sense with --noinput
to automatically assume that the field has been renamed?
Would the autodetector
in handle()
need to get passed a MigrationQuestioner
instance, like it's done in handle_merge
?
Change History (2)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #23407.
This has been fixed for 1.9 (current master branch).
This patch appears to fix it, but is generally untested: