When loading a page, I would like the user to be sent directly to a part of it, called #town-center
.
I've written the following code :
url(r'^(?i)(?P<town_slug>[-\w]+)/', RedirectView.as_view(permanent=False, url='#town-center')), # adds the "town-center" anchor to reposition the browser when displaying the town
url(r'^(?i)(?P<town_slug>[-\w]+)/#$', views.town_map, name='town_map'),
This works in adding #town-center to the current URL, but it fails because the first pattern always gets picked up, and it loops.
The exact error I'm getting from Firefox is : "The page isn't redirecting properly".
How can I make this work ?