I’m trying to implement a generic view that performs some pre-processing and redirects to an external website. Essentially I want to query and update the database before performing the redirect each time the view is accessed.
I spotted Python + Django page redirect but this only deals with simple redirects and not with generic views.
Can anyone provide an example on how this should be implemented?
Any help you can give would be greatly appreciated,
Niall
If you just want to do some processing before performing a redirect, I’m not seeing how generic views come into play for you. You can customize generic views by wrapping them in another function, or in the case of class-based generic views, subclassing them. In your situation, I fail to see how they’d benefit you much, just write a normal view, and use redirect:
Not going to get easier than that.