Issue
How can i pass a dict which contain fields to update a Django model? This is not to create an object, but to update it.
example:
obj = Object.objects.create(index=id, **fields)
Solution
As long as the PK is the same, the existing row will be overwritten.
obj = Object(index=id, **fields)
obj.save()
Answered By - Ignacio Vazquez-Abrams
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.