Django Rest Framework API #15 / Override Delete Action (destroy method) DELETE Request.

  Рет қаралды 6,867

Code Environment

Code Environment

Күн бұрын

Django Rest Framework API, how to override the delete action or destroy method inside ModelViewSet and why would we do that.
How to do DELETE requests using the django rest framework
Source code: github.com/Cod...
Override Create Action Inside ModelViewSet video:
• Django Rest Framework ...
ModelViewset With Serializer and Router:
• Django Rest Framework ...

Пікірлер: 14
@burakhanaksoy
@burakhanaksoy 3 жыл бұрын
Great delivery! I have a question, How did you make your vscode so that it gives you information about get_object() method at 3:45 ? Is that an extension?
@codeenvironment
@codeenvironment 3 жыл бұрын
Thank you, install django extension in your vscode
@muhammadehtisham2708
@muhammadehtisham2708 3 жыл бұрын
Hy sir, in your case "id" show by default you don't add this field in model ,,in my case "id " don't show in output ...and i face problem during delete item
@codeenvironment
@codeenvironment 3 жыл бұрын
“id” is the primary key for the object and gets created when when django create a new object and save it in the database. If you want it to appear, you have to make sure “id” field is included in your serializer fields.
@muhammadehtisham2708
@muhammadehtisham2708 3 жыл бұрын
@@codeenvironment Ok thnx Sir...this series clear it each and every thing.
@kittencode9869
@kittencode9869 3 жыл бұрын
Hi sir, I created an admin token and entered but it didn't work, still "message": "Not Allowed"
@codeenvironment
@codeenvironment 3 жыл бұрын
Please email me your code and I’ll check it out for you
@kittencode9869
@kittencode9869 3 жыл бұрын
@@codeenvironment thanks
@peterhebden1557
@peterhebden1557 3 жыл бұрын
Hey, when I do delete, I keep getting error 405. Any ideas? No idea how to fix this
@codeenvironment
@codeenvironment 3 жыл бұрын
Error 405 means “Method not allowed” sometimes this happened if you don’t add forward slash “/“ at the end of the url after object id. Try that and if the problem persists, please email me at: Codes.environment@gmail.com And I’ll assist with the matter.
@ДаниилЕвгеньевич-ю1й
@ДаниилЕвгеньевич-ю1й 4 жыл бұрын
Hey, where i found def get_object? I don't understand how it work) UPD: sry, for my eng))
@codeenvironment
@codeenvironment 4 жыл бұрын
we can say that get_object() is a built in django function, and it's job is to get the object from the database which it's id is the id that the destroy method receives from the delete request link(url), e.g(4). I hope this explanation helps. Thank you for asking
@yarik83men51
@yarik83men51 3 жыл бұрын
+++
@codeenvironment
@codeenvironment 3 жыл бұрын
“+++” interesting , do you use it to mark the videos you watch 🤔🙂. Thank you for coming by 👌🏻
Django Rest Framework API #16 / Many To One Relationship, Nested Data
20:46
Serializer's - PUT, DELETE Requests | DRF
15:31
Django World
Рет қаралды 1,2 М.
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,2 МЛН
Do you choose Inside Out 2 or The Amazing World of Gumball? 🤔
00:19
An Unknown Ending💪
00:49
ISSEI / いっせい
Рет қаралды 58 МЛН
Django Rest Framework for Beginners - Simple CRUD API
14:22
John Watson Rooney
Рет қаралды 50 М.
Django REST Framework Generic Views
34:22
Bryan Brkic
Рет қаралды 2,3 М.
Django Rest Framework | Serializers & CRUD
22:40
Dennis Ivy
Рет қаралды 387 М.
Django Rest Framework API #28 / Django API Permissions Using Throttling.
16:03
Django Rest Framework API #22 / Many To Many Relationship , Nested Data
31:20
26. View Set | Django Rest Framwork
9:42
Feel Free To Code
Рет қаралды 7 М.