【发布时间】:2012-09-26 08:02:42
【问题描述】:
我的模型中有一个图像,我想自己编写 SQL 创建表查询 我提交的模型是这样的:
pic = models.ImageField(u"initial_picture",blank=True,upload_to="/face")
我想使用命令CREATE TABLE SOME_TABLE_NAME 来创建我的表
但我不知道字段类型应该使用什么
我读过here 我可以使用这样的东西:
Photo varbinary(max) not null
但我不知道它是否与 django 兼容以及是否适合我的模型
我也使用了pic IMAGE DEFAULT NULL,就像我看到的here 一样,结果是数据库结构中的一个varchar(100) 字段
任何帮助都将得到应用 ;-)
Photo varbinary(max) not null 和 Photo varchar(max) not null 我都试过了
该字段正在显示,但是当我按保存时,我收到以下错误:
Attempted access to '\face\sample.gif' denied.
【问题讨论】:
标签: sql django django-models sql-types