﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36016	Avoid traceback when quitting makemigrations with Ctrl-C	Adam Johnson	amansharma612	"Sometimes `makemigration` asks you questions with its “questioner”. If you realize that you missed something due to these questions, you might want to quit with Ctrl-C and edit your models file before rerunning.

Currently, such a quit triggers Python’s default traceback:

{{{
$ ./manage.py makemigrations example
It is impossible to add a non-nullable field 'title' to book without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
 2) Quit and manually define a default value in models.py.
Select an option:  ^CTraceback (most recent call last):
  File ""/.../manage.py"", line 21, in <module>
    main()
    ~~~~^^
  ...
  ...
  ...
  File ""/.../django/db/migrations/questioner.py"", line 169, in ask_not_null_addition
    choice = self._choice_input(
        f""It is impossible to add a non-nullable field '{field_name}' ""
    ...<10 lines>...
        ],
    )
  File ""/Users/chainz/tmp/django-makemigrations-ctrl-c/.venv/lib/python3.13/site-packages/django/db/migrations/questioner.py"", line 114, in _choice_input
    result = input()
KeyboardInterrupt
}}}

This isn’t very user-friendly: it seems like maybe you broke Django, and it pushes the question up out of the terminal window.

Instead, we could quit with minimal output, perhaps a simple message like:

{{{
Select an option:  ^C
Cancelled.
}}}

If there's a message, it should probably use [https://docs.djangoproject.com/en/5.1/ref/django-admin/#syntax-coloring the notice style]."	Cleanup/optimization	closed	Migrations	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
