Как передать аргументы в reverse, чтобы он был доступен в представлении django

Я пытаюсь понять, как обратное действие работает с аргументами, и моя цель здесь - передать тело пост-запроса от одного представления (callerView) к другому (demoView) через функцию. Другими словами, я хочу, чтобы demoVIew вернула тело json-запроса, который был отправлен в callerView (позже я собираюсь сделать некоторые манипуляции с данными в demoView). Я хочу отправлять данные поста на обратный url не в виде строки параметров запроса, а в виде тела.

Urls -

        "api/v2/ada/demo",
        views.demoView.as_view(),
        name="ada-demo",
    ),
    path(
        "api/v2/ada/caller",
        views.callerView.as_view(),
        name="ada-caller",
    ),
]

Функция -

    ada_response = reverse("ada-demo", args=payload)
    return ada_response
<
    permission_classes = (permissions.IsAuthenticated,)
    def post(self, request, *args, **kwargs):
        body = request.data
        response = demo(body)
        return Response(response, status=status.HTTP_200_OK)

class demoView(generics.GenericAPIView):
    permission_classes = (permissions.IsAuthenticated,)
    def post(self, request, *args, **kwargs):
        body = request.data
        return Response(body, status=status.HTTP_200_OK)
<
    def test_caller(
        self
    ):
        rp_payload = {
                    "contact_uuid": "49548747-48888043",
                    "choices": 3,
                    "message": (
                        "What is the issue?\n\nAbdominal pain"
                        "\nHeadache\nNone of these\n\n"
                        "Choose the option that matches your answer. "
                        "Eg, 1 for Abdominal pain\n\nEnter *back* to go to "
                        "the previous question or *abort* to "
                        "end the assessment"
                    ),
                    "step": 6,
                    "value": 2,
                    "optionId": 0,
                    "path": "/assessments/assessment-id/dialog/next",
                    "cardType": "CHOICE",
                    "title": "SYMPTOM"
                }
        user = get_user_model().objects.create_user("test")
        self.client.force_authenticate(user)
        response = self.client.post(
            reverse("ada-caller"),
            rp_payload,
        )
        print(response)
        self.assertEqual(response.status_code, 400, response)```


Error:
```django.urls.exceptions.NoReverseMatch: Reverse for 'ada-demo' with arguments '(<QueryDict: {'contact_uuid': ['49548747-48888043'], 'choices': ['3'], 'message': ['What is the issue?\n\nAbdominal pain\nHeadache\nNone of these\n\nChoose the option that matches your answer. Eg, 1 for Abdominal pain\n\nEnter *back* to go to the previous question or *abort* to end the assessment'], 'step': ['6'], 'value': ['2'], 'optionId': ['0'], 'path': ['/assessments/assessment-id/dialog/next'], 'cardType': ['CHOICE'], 'title': ['SYMPTOM']}>,)' not found. 1 pattern(s) tried: ['api\\/v2\\/ada\\/demo$']```

I need help figuring out how this works. Thanks
Вернуться на верх