Update fields in Viewsets and Mixins

Hello everyone.
How do we use update_fields in Viewsets and Mixins?
On using partial_update in UpdateModelMixin.
model.save() method is trying to run update query on all the model fields instead of updating only changed fields, which is throwing this error →

message: "update or delete on table “users” violates foreign key constraint “coupons_user_code_fkey” on table “coupons”\nDETAIL: Key (code)=(xyz) is still referenced from table “coupons”.\n"

We’re only going to be able to diagnose this in the context of your code. Please post the relevant code and we’ll take a look.

When posting code here in the forum, enclose the code between lines of three backtick - ` characters. You’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code formatted properly, which is critical with Python.