开发者

Django Form Preview with model instance

I've followed the official docs for Form Preview in Django, and I've gotten to the point where I can create new records of a particular model. But what I'm looking to do is update a field in an existing record for a model. I can't figure out how to pass a model instance, or do I somehow bind a model instance to my model form, with F开发者_JAVA百科orm Preview?

Can anyone shed some light on this for me?


The way you update is given here as described in the django documentation.

If you want bind your model instance to a model form you have to look in here check out the first example given for the article form. If you want to update multiple instances then you will have to use a model formset. Its in the same link further down.

hope that helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜