I’ve resorted to introducing a global variable to solve a problem in my artwork-catalog app, and it works, but I don’t like it, so I’m looking for some alternative approaches. (Note: I’ve read this thread re globals).
The app has three views each of which displays a list of artworks. Each of the views’ templates has query form fields (e.g. artwork name, medium, etc); when a query is performed, the view generates a filtered list of artworks which the page displays.
When I then navigate to one of the other views, it displays the previously-filtered list. In other words, the filtered list persists across page views until a new query is performed.
The way I’ve done this is to stuff the filtered artwork list into a global variable, so when a new page is displayed, that’s where it gets its list. Obviously (?) I can’t actually pass the list object around via URL. I suppose I could pass around the request object that produced the filtered list, but that seems … weird.
Any better ideas?