Let's say I want the following url to get matched with a django view through urls.py
: www.mysite.com/cake/#vanilla
In urls.py
I have something like this:
url('^cake/#.*/$', app.views.view ),
So basically I want all urls that start with root: www.mysite.com/cake/#
, to be handled by this view. However, django urls seems to treats # as %23, so instead all urls with root www.mysite.com/cake/%23
is handled by that view. How can I get the hash sign in url('^cake/#.*/$', app.views.view )
, to be treated like an actual hash sign instead of a %23?
Thanks for any help!
A request in Django first comes to urls.py and then goes to the matching function in views.py. Python functions in views.py take the web request from urls.py and give the web response to templates. It may go to the data access layer in models.py as per the queryset.
Django runs through each URL pattern, in order, and stops at the first one that matches the requested URL, matching against path_info . Once one of the URL patterns matches, Django imports and calls the given view, which is a Python function (or a class-based view).
project/urls.py is the one that django uses, so you have to import to project/urls.py. Which means, that you have to state your imports in project/urls.py. The imported urls.py file must also define a valid urlconf, named urlpatterns. I think I had to restart the server (plus forgot the include), works now!
You need to force your users to use IE7 from winetricks. It's the only browser that has the bug of sending the hash and stuff in the HTTP request :)
If it has been fixed, then you need to force your users to use IE7 from winetricks of last year's version.
As Adam stated, browsers should not send the hash part to the server. Using the hash in the url is common for websites like deezer because it lets the user navigate without reloading the page (all navigation is handled in javascript). This allows navigation without interuption/reload of the music player which is in flash.
If you want to enable hash browsing, then you can use a plugin like: http://tkyk.github.com/jquery-history-plugin/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With