I'm trying to get two inputs from a URL into a view by using regular expressions.
My urls.py line looks like this:
(r'^blog/(?P<match>.+)/', 'blog.views.blog'),
And this is my view:
def blog(request, match):
pieces = match.split('/')
However, if my URL is "root.com/blog/user/3" pieces
only returns [user]
.
In order for pieces to return
[user],[3]`, a trailing slash has to be added to my URL: "root.com/blog/user/3/".
And as far as I know and according to my Python shell, the first URL should have returned [user],[3]
.
Am I missing something? Or does Django actually split strings differently from Python?