Update My Listings Page and Navbar
Revisit My Listings view and navbar to reflect the changes of the foreign key setup.
We'll cover the following
There’s one more thing that we have to change. If we log in as any of the users and go to the My Listings page, we will see all listings including those that don’t belong to the currently logged-in user. This is because the code for the Listings view and My Listings view is the same. We did this on purpose a couple of chapters back for simplicity, but let’s fix that now.
My Listings view revisited
The widget below displays the code of views.py. We have edited my_listings
variable in line 38 to show only the listings posted by the currently logged-in user.
Get hands-on with 1400+ tech skills courses.