python - How can I update only certain fields in a Django model form? -
I have a model form that I use to update a model.
Sometimes I do not need to update the entire model, but only one field has to be updated. So when I post only information is available for details when I never save that model, because it thinks that the name is being blanked out, while my intention is that the name does not change and just use it from the model To be done.
turtle_form = TurtleForm (request .post, example = object) if turtle_form.is_valid (): turtle_form.save ()
is there any way to do this The way? Thanks!
Use only the specified field:
class first model forms ModelForm): Square Meta: Model = TheModel fields = ('title', def deftitle) (see itself ....
View Different model models for a model in different scenes, when you want different features, so creating another form for a model using the same behavior (such as clean_
Comments
Post a Comment