2
我有以下型号:谷歌App Engine的Django的模型形式不拿起BlobProperty
class Image(db.Model):
auction = db.ReferenceProperty(Auction)
image = db.BlobProperty()
thumb = db.BlobProperty()
caption = db.StringProperty()
item_to_tag = db.StringProperty()
与以下形式:
class ImageForm(djangoforms.ModelForm):
class Meta:
model = Image
当我打电话ImageForm(),只有非创建Blob字段,如下所示:
<tr><th><label for="id_auction">Auction:</label></th><td><select name="auction" id="id_auction">
<option value="" selected="selected">---------</option>
<option value="ahRoYXJ0bWFuYXVjdGlvbmVlcmluZ3INCxIHQXVjdGlvbhgKDA">2010-06-19 11:00:00</option>
</select></td></tr>
<tr><th><label for="id_caption">Caption:</label></th><td><input type="text" name="caption" id="id_caption" /></td></tr>
<tr><th><label for="id_item_to_tag">Item to tag:</label></th><td><input type="text" name="item_to_tag" id="id_item_to_tag" /></td></tr>
我希望Blob字段也包含在表单中(作为文件输入)。我究竟做错了什么?
尝试此操作,我收到一个错误,指出FileInput未定义。 – Wes 2010-06-22 15:21:11
@Wes:它可能缺少名称空间(我假设你称为django.forms导入djangoforms)。我更新了我的例子。 – 2010-06-22 15:48:05