Django url parsing -pass raw string

I am trying to pass the argument 'string' for a view with a url. Urls.py url is sent

('^add/(?P<string>\w+)', add ),

I'm having problems with lines, including punctuation, newlines, spaces, etc. I think I need to change \ w + to something else. Basically, the string will be copied by the user from the text of his choice, and I do not want to change it. I want to accept any character and special character so that the view acts exactly on what the user copied.

How can I change it?

Thank!

+5
source share
2 answers

, -, , URL-. ? . Django, , , .

-, re, , URL-. \w , _ ( , , , ).

URL- (.. ?paramName= URL- , , +).

+2

, , URL-, URL-.

, URL-:

(?P<string>[\w\-]+)

""; URL- (: "this-is-my_slug" )

+4

All Articles