1👍
So if I understand you correctly you click two times on a link to the same url (like /random_user/
) and you respond with a random redirect. This seems quite unconventional and it doesn’t sound so wrong that Chrome might view this as a single history entry.
To archieve your wanted behaviour across browsers simply generate the random url before you render your random user link.
As you want to use it in multiple views, write a custom template tag:
@register.simple_tag
def random_user_url():
user_url = # generate your random user url
return user_url
In your template:
{% load your_tag_lib %}
<a href="{% random_user_url %}">Random user</a>
This way every click leads the browser to a different url and will be memorized as seperate history entry.
1👍
Use the following code to force the browser not to cache the page. So, clicking back button sends request to server and now you can catch it and redirect him to the desired page.
from django.views.decorators.cache import cache_control
@cache_control(no_cache=True, must_revalidate=True)
def func()
#some code
return
- [Answered ]-Cassandra: occasional permission errors
- [Answered ]-How to set environment variable using Django and Python?
0👍
To be clear, when you say “Back Button” do you mean:
- Browser Back Button
- Your own creation of a Back Button
If 2, are you doing this via client side? Such as via javascript?