Я создаю модель для программы списка задач. Вот мой файл models.py:
from django.db import models
from django.contrib.auth.models import User
class Todo(models.Model):
content = models.CharField(max_length=250)
completed = models.BooleanField(default=False)
author = models.ForeignKey(User, on_delete=models.CASCADE)
def __str__(self):
return self.content
Когда я пытаюсь запустить python manage.py migrate
после выполнения миграций, он выдает мне эту ошибку:
TypeError: memoryview: a bytes-like object is required, not 'bool'
Я не уверен как это исправить, но я предполагаю, что это как-то связано с Булевым полем. Заранее спасибо!
РЕДАКТИРОВАТЬ: Вот вся ошибка, которую я получил:
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Users/thuitema/anaconda3/lib/python3.7/site-
packages/django/core/management/__init__.py", line 401, in
execute_from_command_line
utility.execute()
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 233, in handle
fake_initial=fake_initial,
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 112, in database_forwards
field,
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/backends/sqlite3/schema.py", line 328, in add_field
self._remake_table(model, create_field=field)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/backends/sqlite3/schema.py", line 189, in _remake_table
self.effective_default(create_field)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 303, in effective_default
return field.get_db_prep_save(self._effective_default(field), self.connection)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 821, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/Users/thuitema/anaconda3/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 2262, in get_db_prep_value
return connection.Database.Binary(value)
TypeError: memoryview: a bytes-like object is required, not 'bool'