Skip to content Skip to sidebar Skip to footer

Using A Single Url For Get And Post With Django Rest Framework List_route

The ModelViewSets in DRF have been really helpful, but I'm trying to extend one of them to be able to return a list of objects at a GET request, and process a list on a POST reques

Solution 1:

The actions argument to the ViewSet is a dict, all methods go in that dict:

get_picks = PickViewset.as_view({
    'get': 'update_picks',
    'post': 'update_picks',
})

Post a Comment for "Using A Single Url For Get And Post With Django Rest Framework List_route"