0

I'm at a loss on how I can render a view/template with a hashtag bookmark appended to the URL on page load.

For example, if my URL is r'/mypage/$' and my View is return render(request, 'mypage.html'), how can I have the URL on page load in the browser be: /mypage/#something? The URL/View are not fixed, what I care about is rendering the page in the browser with the #something on it. Note: I need to maintain the RequestContext.

I have visited tens of pages from StackOverflow, the Django docs and Lord Google with no success.

Anyone have any idea how to do this?

Douglas Denhartog
  • 2,036
  • 1
  • 16
  • 23

1 Answers1

0

I don't think render have that but possible with redirect...

return redirect('{}#something'.format(reverse('app:mypage')))
Raja Simon
  • 10,126
  • 5
  • 43
  • 74
  • Interesting! This does in fact achieve the end result in the URL in the browser, unfortunately I cannot use this because I need to maintain the RequestContext. – Douglas Denhartog May 09 '15 at 17:01