Erez
Erez

Reputation: 1953

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

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

Upvotes: 0

Views: 78

Answers (1)

Ismail Badawi
Ismail Badawi

Reputation: 37167

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.

Upvotes: 1

Related Questions