I am trying to implement a regex url for these examples:
localhost:8000/curvas?parcela=298
or
localhost:8000/curvas?parcela=7&fk_fecha=234
I tried implementing a similar url regex from django rest framework (documentation) with the following regex path:
re_path(r'curvas(?P<parcela>.+)', views.CurvasFilter.as_view()),
And it works but it is too permisive, for example that url also match the regex:
localhost:8000/curvas?random=298
How can I change the regex to match only the desired url params?
parcelais part of the querystring, not the path, hence you can not capture this withurl(..),re_path(..)orpath(..).