开发者

Prepopulating a Django FileField

I wanted to know how is it possible in django to bind an already uploaded file (stored in the file system of server) to a Model FileField. This way I want to have my edit page of that model to prepopulate the FileField with this file.

开发者_开发技巧

Thanks


Well I found the answer. It was quite easy actually. you just need to set the FileField value to some string and it will point to that file.

The point is that the path specified should be correct otherwise you get a 404 error when trying to access it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜