Google App Engine django model form does not pick up BlobProperty

Posted by Wes on Stack Overflow See other posts from Stack Overflow or by Wes
Published on 2010-06-13T21:15:17Z Indexed on 2010/06/13 21:22 UTC
Read the original article Hit count: 255

I have the following model:

class Image(db.Model):
    auction = db.ReferenceProperty(Auction)
    image = db.BlobProperty()
    thumb = db.BlobProperty()
    caption = db.StringProperty()
    item_to_tag = db.StringProperty()

And the following form:

class ImageForm(djangoforms.ModelForm):
    class Meta:
        model = Image

When I call ImageForm(), only the non-Blob fields are created, like this:

<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>

I want the Blob fields to be included in the form as well (as file inputs). What am I doing wrong?

© Stack Overflow or respective owner

Related posts about python

Related posts about google-app-engine