Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

have a url that accepts all characters

Tags:

python

django

I want a url that accepts all characters,for example:

(r'^company/(?P<key>[a-zA-Z]+)/doclist/$','CompanyHub.views.docList')

for key parameter instead of just ascii alphabetic characters It accepts all characters include numbers,symbols like $,-,_,...,alphabet,unicode characters,...

how can I do this?

like image 963
Asma Gheisari Avatar asked Jul 08 '12 15:07

Asma Gheisari


2 Answers

Your code should look like this:

(ur'^company/(?P<key>.*)/doclist/$','CompanyHub.views.docList')

We need the 'u' at the beginning to tell python that the string accepts unicode characters.

like image 111
tsikov Avatar answered Oct 10 '22 13:10

tsikov


RegEx would look like this:

(.*)

That should match all characters except new line characters.

like image 25
Alex W Avatar answered Oct 10 '22 12:10

Alex W