Always use select_related(depth=1) when fetching items in a DataGrid.
Review Request #816 — Created April 14, 2009 and submitted — Latest diff uploaded
Always use select_related(depth=1) when fetching items in a DataGrid. We were conditionally calling select_related(depth=1) based on sort orders when fetching items from the DataGrid. However, in many (most?) cases, cells are going to display data on models from foreign keys on the object. So, we instead always call select_related(depth=1), since it's not that much more expensive a query, but may save several subsequent queries per row.
Tested with our various datagrids. Nothing broke, as nothing should with this query. It's just loading additional data.