Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#32900 closed Cleanup/optimization (fixed)

Migrations questioner uses bad grammar

Reported by: Christian Ullrich Owned by: Mateo Radman
Component: Migrations Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Christian Ullrich)

The interactive questioner, when it asks what to do about changes in nullability or adding a NOT NULL field, provides multiple options. Some of these speak to the user, some as the user.

One example of several:

You are trying to add a non-nullable field 'id' to mymodel without a default; we can't do that (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 let me add a default in models.py

In option 1, Django offers the user the choice of entering the default value. Option 2 instead is the user telling Django what to do.

Each time I read this, I'm asking myself who the "me" in option 2 is. The most egregious case is in InteractiveMigrationQuestioner.ask_not_null_alteration(): "[...] let me handle existing rows [...] (e.g. because you added a RunPython [...]". In this sentence, "me" and "you" are the same.

Fix: Either reword the "provide" options to say "Let me enter a one-off default now", or the "let me" options to the same style as the "provide" options. I am very much in favor of the latter because I think this "me, the user" style is terrible.

Change History (18)

comment:1 by Christian Ullrich, 5 years ago

Description: modified (diff)

comment:2 by Jacob Walls, 5 years ago

Easy pickings: set
Triage Stage: Unreviewed → Accepted

Thanks, this has also occurred to me. For the example you quoted in full, perhaps: "Quit, so that a default in models.py can be added later." And something similarly passive for the other cases, avoiding the use of "you" entirely.

comment:3 by Mateo Radman, 5 years ago

Owner: changed from nobody to Mateo Radman
Status: new → assigned

comment:4 by Mateo Radman, 5 years ago

Resolution: → fixed
Status: assigned → closed

​PR is ready. Let me know if you have any suggestions regarding phrasing the questions.

comment:5 by Tim Graham, 5 years ago

Has patch: set
Resolution: fixed
Status: closed → new

When adding a PR, the correct action is to check "Has patch" rather than close the ticket. See ​Triaging tickets and the "According to the ticket's flags, the next step(s) to move this issue forward are:" section of each open ticket.

comment:6 by Muhammad Hammad, 5 years ago

Owner: changed from Mateo Radman to Muhammad Hammad
Status: new → assigned

comment:7 by Mariusz Felisiak, 5 years ago

Owner: changed from Muhammad Hammad to Mateo Radman

Muhammad, this ticket is already assigned to Mateo. Please try to find a ticket that is not assigned.

comment:8 by Mateo Radman, 5 years ago

I think ​PR is ready to be merged. Thanks for everyone’s suggestions and involvement.

comment:9 by Mariusz Felisiak, 5 years ago

Needs tests: set
Patch needs improvement: set

comment:10 by Mateo Radman, 5 years ago

Needs tests: unset
Patch needs improvement: unset

comment:11 by Mariusz Felisiak, 5 years ago

Needs tests: set

comment:12 by Mateo Radman, 5 years ago

Needs tests: unset

comment:13 by Mariusz Felisiak, 5 years ago

Triage Stage: Accepted → Ready for checkin

comment:14 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In d00fb4d2:

Refs #32900 -- Added test for ignoring the default value in InteractiveMigrationQuestioner.ask_not_null_alteration().

comment:15 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 61c5eae:

Refs #32900 -- Added makemigrations tests for messages in interactive mode.

comment:16 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: → fixed
Status: assigned → closed

In 02bc7161:

Fixed #32900 -- Improved migrations questioner prompts.

comment:17 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In aa0d796e:

Refs #32900 -- Restored '[y/N]' in questioner prompt when merging migrations.

Regression in 02bc7161ec477afd4a7b328936eb8adac078d7b9.

comment:18 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 1aada25e:

[4.0.x] Refs #32900 -- Restored '[y/N]' in questioner prompt when merging migrations.

Regression in 02bc7161ec477afd4a7b328936eb8adac078d7b9.

Backport of aa0d796e37c4b8056148de2f68726aae9d20399c from main

Note: See TracTickets for help on using tickets.
Back to Top