开发者

Can't create a form to upade part of a model field

开发者 https://www.devze.com 2023-03-16 18:48 出处:网络
This is really frustrating, I can\'t and can\'t find how to create a form (I\'m guessing a forms.Form form) to update just one field of a more complex model.

This is really frustrating,

I can't and can't find how to create a form (I'm guessing a forms.Form form) to update just one field of a more complex model.

The model has 5 fields, and a form to create, update all of them.

But in a different case i need to let the user update only the title (a field in the model), so i need tried so man开发者_Go百科y things until now (including creating an HTML form by hand and from the view to save it, creating a forms.Form and many more, nothing seem to work), There is no code here because i don't even know which one to put....

Maybe some one can help me with that, I'm sure it is a simple thing, But for some reason i am stuck on this for a long time...

Thank you, Erez


If you're using ModelForms, you just have to define a fields attribute in Meta as a tuple containing just the names of the fields you want. See the documentation.

0

精彩评论

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