0

I've got a url set up like in python django 1.9

url(r'^faq/?$', views.faq, name="faq"),

However, if I go to a url with #anchors in them, it keeps removing the #anchor part in all browsers.

So, localhost:5000/faq#12 always goes to localhost:5000/faq.

How do I get django to keep the #anchor section?

UPDATE:

I'm not trying to pass any data to the server. The FAQ page has a bunch of questions with unique id. /faq#12 should take the view directly to the div#12. It's for the browser and doesn't have anything to do with the server side at all.

Lordking
  • 1,413
  • 1
  • 13
  • 31

2 Answers2

1

Anchor part of the url not sent to the server. it only used at client side.

sam
  • 29
  • 2
  • I know that. I'm not trying to pass data to the server. The anchor is for the browser so that it can take the user directly to the part of the page they need to go to. However, the anchor part keeps disappearing. – Lordking Sep 16 '16 at 14:34
0

Your url config defines a slash at the end, so you have to use it in the URL as well:

http://localhost:5000/faq/#12

If you miss it, there will be a redirect that removes the anchor.

Klaus D.
  • 13,874
  • 5
  • 41
  • 48