[Answer]-Django RestFrame work to update the fied

1👍

You can wright an update function in your serializers like this.Following

def update(self, instance, validated_data):

        user.set_password(validated_data.get('new_password', new_password))
        user.save()
        return instance

Here user is the user object and in your views.py you have to pass the model object like this

change_pwdform = change_pwdform(object, data=request.DATA, partial=True)

This worked for me and you can also referhttp://www.django-rest-framework.org/api-guide/serializers/#customizing-multiple-update

Leave a comment