I’m new at this; so if there is a better way to send this info,please tell me. Thank you for your willingness to help. I’m sending this all to a mySQL database.
(env) PS C:\dbDeerfield240915\dfArchive> py manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, posts, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying posts.0001_initial... OK
Applying posts.0002_access_levels_remove_post_body_remove_post_date_and_more... OK
Applying posts.0003_images... OK
Applying posts.0004_keywords... OK
Applying posts.0005_photographers... OK
Applying posts.0006_alter_images_date_day_alter_images_date_month_and_more... OK
Applying posts.0007_alter_images_date_day_alter_images_date_month_and_more... OK
Applying posts.0008_alter_images_caption_alter_images_envelope_id... OK
Applying posts.0009_alter_images_caption... OK
Applying posts.0010_alter_images_image_comments...Traceback (most recent call last):
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\mysql\base.py", line 76, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'image_comments' can't have a default value")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\dbDeerfield240915\dfArchive\manage.py", line 22, in <module>
main()
File "C:\dbDeerfield240915\dfArchive\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\commands\migrate.py", line 357, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\executor.py", line 255, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\migration.py", line 132, in apply
operation.database_forwards(
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\operations\fields.py", line 241, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\base\schema.py", line 905, in alter_field
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\base\schema.py", line 1162, in _alter_field self.execute(
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\base\schema.py", line 202, in execute
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 122, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\mysql\base.py", line 76, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'image_comments' can't have a default value")
(env) PS C:\dbDeerfield240915\dfArchive> py manage.py makemigrations
Migrations for 'posts':
posts\migrations\0022_remove_images_image_comment.py
- Remove field image_comment from images
(env) PS C:\dbDeerfield240915\dfArchive> py manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, posts, sessions
Running migrations:
Applying posts.0010_alter_images_image_comments...Traceback (most recent call last):
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\mysql\base.py", line 76, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'image_comments' can't have a default value")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\dbDeerfield240915\dfArchive\manage.py", line 22, in <module>
main()
File "C:\dbDeerfield240915\dfArchive\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\core\management\commands\migrate.py", line 357, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\executor.py", line 255, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\migration.py", line 132, in apply
operation.database_forwards(
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\migrations\operations\fields.py", line 241, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\base\schema.py", line 905, in alter_field
self._alter_field(
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\base\schema.py", line 1162, in _alter_field self.execute(
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\base\schema.py", line 202, in execute
cursor.execute(sql, params)
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 122, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\django\db\backends\mysql\base.py", line 76, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\dbDeerfield240915\env\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'image_comments' can't have a default value")
(env) PS C:\dbDeerfield240915\dfArchive>
models.py…
from django.db import models
# Create your models here.
class Access_Levels(models.Model):
access_level = models.CharField(max_length=15, help_text='Management, Staff, Public')
def __str__(self):
return self.access_level
class Images(models.Model):
accession_code = models.CharField(max_length=50, unique=True, db_index=True)
date_year = models.CharField(max_length=4, db_default="0000")
date_month = models.CharField(max_length=4, db_default="00")
date_day = models.CharField(max_length=4, db_default="00")
caption = models.CharField(max_length=50, db_default="Enter caption", blank=True)
raw_file_exists = models.BooleanField(db_default=False)
envelope_id = models.CharField(
max_length=50,
blank=True,
help_text="To link to Lisa's physical prints some day"
)
photographers_id = models.IntegerField
orientation_vertical = models.BooleanField(db_default=False)
access_level = models.OneToOneField(
Access_Levels,
on_delete=models.RESTRICT,
)
# the django interpreter would not let me have a textfield for comments with or without a default
def __str__(self):
return self.accession_code
class Photographers(models.Model):
fname = models.CharField(max_length=50)
lname = models.CharField(max_length=50)
email = models.EmailField
address_street = models.CharField(max_length=50)
address_city = models.CharField(max_length=50)
address_state = models.CharField(max_length=50)
address_zip = models.CharField(max_length=50)
last_updated = models.DateTimeField(auto_now_add=True)
def __str__(self):
full_name = self.lname + ", " + self.fname
return self.full_name
class Keywords(models.Model):
keyword = models.CharField(max_length=50)
Images_image_id = models.ManyToManyField(Images)
def __str__(self):
return self.keyword
class Post(models.Model):
title = models.CharField (max_length=50)