Let's say we have a simple Django app with a blog model.
There are only 3 pages:
- Home page
- Blog index
- Blog post detail
The blog posts are listed in 3 locations:
- In a slider on the home page
- In the blog index (of course)
- At the bottom of a blog post
There are 2 main ways of using breadcrumbs I've seen on a site:
- Home / Blog / Blog Post
- < Back
I want to be able to have the "< Back" button go back to whichever the original source came from.
I'm aware this could be done with JavaScript.
But with Django, I've heard people say on another post that "you shouldn't redirect in a template, you should do it in view", but to me that makes no sense as how is the view supposed to know which page to go back to automatically?
Anyways, I'm trying to see is:
How would you link back to the source page you arrived at a blog post from (i.e., another post, the home page, or the blog index) using Django views or in the Django template?