>>>>>>>django.core.exceptions.ValidationError : [u"'' value must be either True or False."]
Have you tried to set the default value of the BooleanField as True or False? BooleanFields must have a valid boolean as default value and so happends that empty string is not a valid boolean.
2017-06-30 14:23 GMT-03:00 <pieceofkayk2718@gmail.com>:
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/ , line 363, in execute_from_command_linemanagement/__init__.py"
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/ , line 355, in executemanagement/__init__.py"
self.fetch_command(subcommand). run_from_argv(self.argv)
File "/usr/lib64/python2.7/site-packages/django/core/ , line 283, in run_from_argvmanagement/base.py"
self.execute(*args, **cmd_options)
File "/usr/lib64/python2.7/site-packages/django/core/ , line 330, in executemanagement/base.py"
output = self.handle(*args, **options)
File "/usr/lib64/python2.7/site-packages/django/core/ , line 204, in handlemanagement/commands/migrate. py"
fake_initial=fake_initial,
File "/usr/lib64/python2.7/site-packages/django/db/migrations/ , line 115, in migrateexecutor.py"
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/ , line 145, in _migrate_all_forwardsexecutor.py"
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/lib64/python2.7/site-packages/django/db/migrations/ , line 244, in apply_migrationexecutor.py"
state = migration.apply(state, schema_editor)
File "/usr/lib64/python2.7/site-packages/django/db/migrations/ , line 129, in applymigration.py"
operation.database_forwards(self .app_label, schema_editor, old_state, project_state)
File "/usr/lib64/python2.7/site-packages/django/db/migrations/ , line 86, in database_forwardsoperations/fields.py"
field,
File "/usr/lib64/python2.7/site-packages/django/db/backends/ , line 238, in add_fieldsqlite3/schema.py"
self._remake_table(model, create_field=field)
File "/usr/lib64/python2.7/site-packages/django/db/backends/ , line 113, in _remake_tablesqlite3/schema.py"
self.effective_default(create_field )
File "/usr/lib64/python2.7/site-packages/django/db/backends/ , line 229, in effective_defaultbase/schema.py"
default = field.get_db_prep_save(default, self.connection)
File "/usr/lib64/python2.7/site-packages/django/db/models/ , line 766, in get_db_prep_savefields/__init__.py"
prepared=False)
File "/usr/lib64/python2.7/site-packages/django/db/models/ , line 758, in get_db_prep_valuefields/__init__.py"
value = self.get_prep_value(value)
File "/usr/lib64/python2.7/site-packages/django/db/models/ , line 1039, in get_prep_valuefields/__init__.py"
return self.to_python(value)
File "/usr/lib64/python2.7/site-packages/django/db/models/ , line 1032, in to_pythonfields/__init__.py"
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 .
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/CAOs3Lp4EHC3xqzqK2EJWGrZ0cR1r7w9q1ZpFBCxFoRz-OS67Hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment