How to effectively use PUT and DELETE HTTP methods in Django Class-Based Views?

2024-04-12 Thread Mamadou Alpha Bah
I'm setting up a CRUD system with Django, using Class-Based Views. Currently I'm trying to figure out how to handle HTTP PUT and DELETE requests in my application. Despite searching the Django documentation extensively, I'm having trouble fin

DRF Trailing Slah

2024-04-12 Thread MISHEL HANNA
Hello i have endpoint when add / to the end of it i can not send request it return this Not Found: /api/v1/properties/user/ [12/Apr/2024 20:19:03] "GET /api/v1/properties/user/ HTTP/1.1" 404 23 but when remove / from the end of it return success [12/Apr/2024 20:19:09] "GET /api/v1/properties/use

Re: DRF Trailing Slah

2024-04-12 Thread Luis Zárate
Check your URL.py and append the slash, also take a look of https://docs.djangoproject.com/en/5.0/ref/settings/#append-slash El vie, 12 abr 2024 a las 15:40, MISHEL HANNA () escribió: > Hello > i have endpoint when add / to the end of it i can not send request it > return this > Not Found: /api/

Re: How to effectively use PUT and DELETE HTTP methods in Django Class-Based Views?

2024-04-12 Thread Luis Zárate
See https://docs.djangoproject.com/en/5.0/topics/class-based-views/#supporting-other-http-methods Also on view you have a variable called, where you can limit the available methods. http_method_names El vie, 12 abr 2024 a las 7:20, Mamadou Alpha Bah (< mamadoualphabah...@gmail.com>) escribió: >

Re: How to effectively use PUT and DELETE HTTP methods in Django Class-Based Views?

2024-04-12 Thread Luis Zárate
Also a recomendation, see that `dispatch` method call the view as handler(request, *args, **kwargs) So maybe is a good idea do something like: class MyView(view): def put(self, request, *args, **kwargs): ... Regards, El vie, 12 abr 2024 a las 16:13, Luis Zárate () escribió: