I want to pass a variable from the requested url to a view. With a predefined variable-length or just ja number it woudn’t be a problem, but now my variable to pass can differ in length.
I want something like this
url(r'^test/(?P<my_var>\d+)/$', views.Vote),
but my_var should be able to be for example hello, blablabla or where_am_i_going.
The URL patters are regular expressions, so just use one that captures values you expect. From your description it sounds like you want to match one or more alphanumeric characters or underscores. In that case the pattern would look like this: