我正在使用基于函数的api
{host}:{port}/api/food/<year>/<month>/<day>/
现在,我对模型 Food 具有新的视图集。
{host}:{port}/food/
我希望集成此API到一个ModelViewSet,以便我确实喜欢下面的。
{host}:{port}/food/files/<year>/<month>/<day>/
{host}:{port}/food/
class FoodViewSet(viewsets.ModelViewSet):
queryset = Food.objects.all()
permission_classes = [blahblah]
authentication_classes = [blahblah]
def list(self, request, *args, **kwargs):
...
return Response(blahblah)
def create(self, request, *args, **kwargs):
...
return Response(blahblah)
@action(['GET'], detail=True)
def files(self, request, year, month, day):
...
return Response(blahblah)
答案 0 :(得分:0)
对不起,我使用如下查询网址清除了此问题。
git difftool one_branch two_branch
{host}:{port}/food/files/?year=2019&month=02&day=27