Thanks for that. Now it begins to make sense. However…
Things get even more muddled. If I try to do:
python3 manage.py makemigrations polls
I get
You are trying to add a non-nullable field ‘choice_text’ to choice without a default; we can’t do that (the database needs something to populate existing rows).
Please select a fix:
- Provide a one-off default now (will be set on all existing rows with a null value for this column)
- Quit, and let me add a default in models.py
Select an option:
I don’t know what to do here.
If I run the shell, the response to:
Question.objects.all() is now:
Traceback (most recent call last):
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/utils.py”, line 86, in _execute
return self.cursor.execute(sql, params)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py”, line 396, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: polls_question.question_text
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/usr/lib/python3.6/code.py”, line 91, in runcode
exec(code, self.locals)
File “”, line 1, in
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/models/query.py”, line 252, in repr
data = list(self[:REPR_OUTPUT_SIZE + 1])
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/models/query.py”, line 276, in iter
self._fetch_all()
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/models/query.py”, line 1261, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/models/query.py”, line 57, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/models/sql/compiler.py”, line 1137, in execute_sql
cursor.execute(sql, params)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/utils.py”, line 100, in execute
return super().execute(sql, params)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/utils.py”, line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/utils.py”, line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/utils.py”, line 86, in _execute
return self.cursor.execute(sql, params)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/utils.py”, line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/utils.py”, line 86, in _execute
return self.cursor.execute(sql, params)
File “/home/edwin/.local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py”, line 396, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: polls_question.question_text
Oops!!