【发布时间】:2011-06-01 22:50:33
【问题描述】:
嘿, 我已经创建了一个数据库。现在我更新了 UserProfile:
class UserProfile(models.Model):
user = models.ForeignKey(User, unique = True, related_name = 'user')
follows = models.ManyToManyField("self", related_name = 'follows') <-- NEW LINE
所以python manage.py sqlall myapp 回复我:
[...]
CREATE TABLE "myapp_userprofile_follows" (
"id" integer NOT NULL PRIMARY KEY,
"from_userprofile_id" integer NOT NULL,
"to_userprofile_id" integer NOT NULL,
UNIQUE ("from_userprofile_id", "to_userprofile_id")
)
[...]
当我运行python manage.py syncdb:
Creating tables ...
Installing custom SQL ...
Installing indexes ...
No fixtures found.
但是当我尝试向其中插入数据时,没有创建表。为什么? (我在本地测试,使用 sqlite3)
【问题讨论】: