这是我制作的数据库表
from __future__ import unicode_literals
from django.db import models
class Venue(models.Model):
name = models.CharField(max_length=100)
address = models.ForeignKey('Address', blank=True, related_name='venue', on_delete=models.CASCADE)
phone = models.BigIntegerField(blank=True)
class Address(models.Model):
street1 = models.CharField(max_length=100)
street2 = models.CharField(max_length =100)
city = models.CharField(max_length = 100)
state = models.CharField(max_length = 2, blank =True)
zipcode = models.PositiveSmallIntegerField()
country = models.CharField(max_length = 100, blank = True)
这里是堆栈跟踪,它似乎是django specificc。有人以前见过这个吗?
Apply all migrations: admin, auth, contenttypes, sessions, venue
Running migrations:
Applying venue.0002_auto_20161220_2343...Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/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 "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/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 "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/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 "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards
field,
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/backends/postgresql/schema.py", line 21, in add_field
super(DatabaseSchemaEditor, self).add_field(model, field)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 395, in add_field
definition, params = self.column_sql(model, field, include_default=True)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 147, in column_sql
default_value = self.effective_default(field)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 221, in effective_default
default = field.get_db_prep_save(default, self.connection)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 909, in get_db_prep_save
return self.target_field.get_db_prep_save(value, connection=connection)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 755, in get_db_prep_save
prepared=False)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 938, in get_db_prep_value
value = self.get_prep_value(value)
File "/home/rickus/211hospitality/com.suitsandtables/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 946, in get_prep_value
return int(value)
TypeError: int() argument must be a string or a number, not 'dict'
我正在使用postgress后端。我的代码和迁移的外观,这一切都没有意义。相当令人沮丧。