I am making development, and my POST request come like config/alert and I am trying to catch it with action decorater below.BUT Django does not catch it It wants config/alert/ but It is not possible to change incoming url add the SLASH.
@action(methods=['post'], detail=False, url_path='alert')
def get_post(self, request, pk=None, *args, **kwargs):
How can I modify the action to listen without slash in POST request?
CodePudding user response:
I guess you have to check the APPEND_SLASH
setting in your settings.py file.
You can find more information about option here: https://docs.djangoproject.com/en/dev/ref/settings/#append-slash
CodePudding user response:
I found the solution adding extra APIView and putting ? end of the re_path in urls.py
re_path(r'alerta_forward/alert/?', post_data)
With using ? it became option slash, then I called an APIView.