Tastypie difference between list_allowed_methods and detail_allowed_methods

everything! I need to develop an API for a site written in django, but when I read the documentation on tastipi, I was really confused. The documentation is as follows:

allowed_methods 

Manages the list and details of the REST methods the resource should respond to. j. The default value is None, which means delegating to more specific list_allowed_methods and detail_allowed_methods. You can specify a list, for example ['get', 'post', 'put', 'delete'] as a shortcut to prevent others from being specified.

 list_allowed_methods 

Manages the list of REST methods the resource should respond to. Default: ['get', 'post', 'put', 'delete'].

 detail_allowed_methods 

Manages the list of REST methods the resource should respond to. Default: ['get', 'post', 'put', 'delete'].

According to these docs, list_allowed_methods and detail_allowed_methods are exactly the same ... Is there anyone who can tell them apart? And what exactly is each of them used for?

Thanks in advance!

+8
api django
source share
1 answer

OK I found the answer and I will just post it here if this can help someone.

Methods starting with a "list" are responsible for manipulating the set returned by tastypie, for example, all entries in your blog.

While methods starting with "detail" are responsible for manipulating the element. For example, one specific entry on your blog.

Wish it helps!

+24
source share

All Articles