jws wrote: > I'd like to hear some discussion regarding what seems to be a common > situation and how to best address it within Django-powered sites. > > Frequently there will be hierarchical data stored in the db as tables > with foreign keys linking lower-level tables to their parents. As an > example, let's presume three tables representing state, county and city > to identify a location in the U.S. It would be wildly impractical to > try to create a select form from a list of every city nationwide. > Clearly the choice of state should constrain the possible values of the > county, and likewise, the city. One option is to pass the user through > a series of forms, adding fields as we drill down. I would prefer, > however, to process the fields in a single page, to better integrate > with interfaces like the admin middleware. > > Either way, the admin does neither thing today. It seems to me that > situations like this would happen regularly and would be an excellent > candidate for inclusion in the admin. All the information required to > create the interface already exists in the model definitions. > > Any thoughts? > >
If I understand what you are asking for, you have one entity (lets say a person), which has a reference to a city. Rather than just having a select list of all cities, you would like some hierarchical selection (maybe a javascript menu or a set of select lists). This isn't yet available - file a ticket, maybe with a UI mockup. At the moment the closest thing available is the raw_id_admin feature. This allows a popup window of the change list. In here, you could have search or filter options to allow people to narrow down their search for a city. Robert