tags:

views:

101

answers:

2

Is there a way in Django to accept 'n' parameters which are delimited by a '/' (forward slash)?

I was thinking this may work, but it does not. Django still recognizes forward slashes as delimiters.

(r'^(?P<path>[-\w]+/)$', 'some.view', {}),
+1  A: 

Certainly, Django can accept any URL which can be described by a regular expression - including one which has a prefix followed by a '/' followed by a variable number of segments separated by '/'. The exact regular expression will depend on what you want to accept - but an example in Django is given by /admin URLs which parse the suffix of the URL in the view.

Vinay Sajip
+2  A: 

Add the right url to your urlpatterns:

# ...
("^foo/(.*)$", "foo"), # or whatever
# ...

And process it in your view, like AlbertoPL said:

fields = paramPassedInAccordingToThatUrl.split('/')
Ian P