Рет қаралды 16,320
What you will learn:
How to override UPDATE action | method inside Django REST Framework. -
How to override UPDATE action | method inside ModelViewSet.
How to override PUT action | method inside ApiView.
How to read the data that was sent through a PUT request using (request) argument then update an object and save it in the database.
Note: If you have more than on object then you need to use " url variables " with API Views like:
"localhost:8000/cars_app/cars?id=1"
and inside your put method you need to add:
id = request.query_params["id"]
# To get the object id from the url
car_object = Cars.objects.get(id=id)
# To get the object that we need to update
Source code: github.com/Cod...
🎧 Music : • Study music | Programm...
Music Channel : @tuningthecode
APIView GET & POST Request and Response:
• Django Rest Framework ...
Override Create Action | CREATE Method:
• Django Rest Framework ...
Override Delete Action (destroy method) DELETE Request:
• Django Rest Framework ...
ModelViewset With Serializer and Router:
• Django Rest Framework ...