Friday, June 30, 2017

Database validation error - Even after manage.py flush.

So I made the ultimate error.  I put a BooleanField in my models.py, when I made migrations I set default col value to the empty string ''.. Then I migrated and got a validation error.  However, I have tried to delete the model containing BooleanField, delete my database file, and I even ran manage.py flush and cannot seem to get rid of this error.  If anyone has any experience with BooleanField errors please help.  My traceback from my terminal is below:

  Applying build_a_bundle.0012_auto_20170630_1027...Traceback (most recent call last):
 
File "manage.py", line 22, in <module>
    execute_from_command_line
(sys.argv)
 
File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility
.execute()
 
File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
   
self.fetch_command(subcommand).run_from_argv(self.argv)
 
File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
   
self.execute(*args, **cmd_options)
 
File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output
= self.handle(*args, **options)
 
File "/usr/lib64/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial
=fake_initial,
 
File "/usr/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state
= self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
 
File "/usr/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state
= self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
 
File "/usr/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state
= migration.apply(state, schema_editor)
 
File "/usr/lib64/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation
.database_forwards(self.app_label, schema_editor, old_state, project_state)
 
File "/usr/lib64/python2.7/site-packages/django/db/migrations/operations/fields.py", line 86, in database_forwards
    field
,
 
File "/usr/lib64/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 238, in add_field
   
self._remake_table(model, create_field=field)
 
File "/usr/lib64/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 113, in _remake_table
   
self.effective_default(create_field)
 
File "/usr/lib64/python2.7/site-packages/django/db/backends/base/schema.py", line 229, in effective_default
   
default = field.get_db_prep_save(default, self.connection)
 
File "/usr/lib64/python2.7/site-packages/django/db/models/fields/__init__.py", line 766, in get_db_prep_save
    prepared
=False)
 
File "/usr/lib64/python2.7/site-packages/django/db/models/fields/__init__.py", line 758, in get_db_prep_value
    value
= self.get_prep_value(value)
 
File "/usr/lib64/python2.7/site-packages/django/db/models/fields/__init__.py", line 1039, in get_prep_value
   
return self.to_python(value)
 
File "/usr/lib64/python2.7/site-packages/django/db/models/fields/__init__.py", line 1032, in to_python
   
params={'value': value},
django
.core.exceptions.ValidationError: [u"'' value must be either True or False."]



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc30ad69-a4b8-4163-8f7e-7a5d0d42fbd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment