I'm doing a slideshow and each slide has a url format like this: articles/1234#slide=5
. I want to retrive the slide=5
part from the url in my url.py file and then pass it to the corresponding view function and finally, pass it to the template and render the right slide. The url settings is as follows:
url(r'^(?P<article_id>\d+)#slide=(?P<current_slide>\d{1,2})$', 'articles.views.show_article')
But it seems that it cannot get the current_slide
variable from the url. I guess it has something to do with the anchor part cause it's not transferred to the server. But if I ignore the anchor part in my url settings and use javascript to handle this hashtag, it seems that everytime I enter the url in browser, it first renders the page without the anchor part and then jumps to the right slide I want. It cannot render the right slide directly. How could I fix this?