Reputation: 824
I would like to match URL string "anything#1" in django. My regular expression goes like this:
r'^(?P<title>\w+[_]*)?/#(?P<id>\d+)/$'
The "#1" part should be optional, so I put question mark there. However it shows me an error. What am I doing bad?
Upvotes: 1
Views: 134
Reputation: 9285
Django doesn't control signet (or fragment), you can get it in your view with HttpRequest.get_full_path()
:
Get it only with :
>>> request.get_full_path().split('#')[1]
'1'
Upvotes: 2