Skip to content
Advertisement

How to Update a field in Django

I want to Update only name field if only name is sent from frontend, update only image if only image is sent from frontend, update both if name & image is sent from frontend In Django

JavaScript

Advertisement

Answer

You can construct a dictionary that only contains the key-value pairs to update and then use .update(…) [Django-doc] to update the corresponding Category record:

JavaScript
Advertisement