I have the following two regex patterns.
url(r"^list/(?P<email>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})?/?", MyFunction_ListAPIView.as_view()),
url(r"^list/(?P<id>[\d+])/$", OtherFunction_ListAPIView.as_view()),
I wanted to have two separate functions for email and for id.
If an email is passed MyFunction
should be called however if a decimal value is passed then OtherFunction
should be called.
I just passed in a decimal value like so - Here 11 is a decimal value and not regex. Yet it is still calling the same function. Any suggestions on what I might be doing wrong ?
http://127.0.0.1:8000/api/job/list/11/