0

I want to update a Django model instance using ajax PUT request and a Django REST API . What I want to do is to send only the values that will be updated within the PUT request. I used a Jquery DataForm object. But I get an error saying that there are required fields that can not be empty. Is there a way to indicate that those fields should keep their old values ? Thank you for your help.

Akamee
  • 593
  • 1
  • 6
  • 21
  • 1
    use method `PATCH` here example: https://stackoverflow.com/questions/11461414/ajax-json-doesnt-get-sent-in-patch-only – Brown Bear Aug 03 '17 at 09:56

1 Answers1

0

If you're using Django REST Framework then you can allow partial updates in model instances.

http://www.django-rest-framework.org/api-guide/serializers/#partial-updates

Hope this helps.

Aakash Rayate
  • 934
  • 7
  • 17