i want to build a ModelViewSet class that recive an id from url for instance
localhost/id
and based on that id i can either show the object with matching id or delete the object but im having trouble passing the id in the url my view is like this:
class delete_or_show_View(viewsets.ModelViewSet):
serializer_class = ObjectSerializer
permission_classes = [permissions.IsAuthenticated]
http_method_names = ['get', 'delete']
def get_queryset(self,mid):
#Show the object
def destroy(self, mid):
#delete the object
and my url is like this
router.register('(?P<object_id>\d+)', views.delete_or_show_View, basename='do_stuff')
Im getting errors for missing aruguments or that the delete method is not allowed please if someone can guide me how i can do this properly and explain it will be great thank you