I'm rewriting a Rails application in Django, and thusfar it's been a pleasant process. However, I'm having a conceptual block on how to solve a problem "the Django way."
My application has essentially three types of objects that users will view (lets call them Foo, Bar, and Baz), and each of those objects has a list view and a detail view. I used the list/detail generic view, and it's great. My problem is in how I get my users *to* the list view. I have a bank of queries that the user navigates through, things like "Find all Foos related to Bar" or "Find all Bazes created in the last week." The user clicks on the name of such a query and is brought to a form page. In Rails, I was automatically generating that page by storing each query in the database with a few flags to format the look of the form; this worked, but I'm not wed to the approach. At any rate, the user fills out the form, and clicks "Submit." Here's where it gets tricky. Two of the fields in the automatically generated form told Rails which controller and view to send the result of the query, and those fields were used to contruct the "action" property on that page's form tag. Successful queries were sent off to, say, "foos/list" or "bars/list." Tricky, but it fits in the Rails "object lifecycle" or whatever you'd like to call it. I'm not sure what the equivalent is for Django. Automatic form generation nonsense aside, is it possible to "dynamically" hand an array of objects off to a generic view? Basically, is there any way to do this without hand-coding a new urlpattern, view, and template for each of the nearly twenty queries I have? Thanks for your thoughts, John
