Convert dashboard to be a generic view

Review Request #47 — Created June 3, 2007 and submitted

Information

Review Board SVN (deprecated)
trunk
75

Reviewers

We weren't using generic views in the dashboard because there's
a bug in Q objects that was preventing us from creating a query
for the "all incoming reviews" view.  We hacked around this by
doing the OR+distinct step ourselves using lists.

It turns out that with just a little coaxing, django's generic
object_list view can be used with a list instead of a QuerySet.
This change does that, and makes the dashboard into a simple
superset of object_list.  The major benefit of this is that we
get pagination basically for free.
Set pagination interval very low (for my meager number of
review requests in my test server) and tried a couple
different views in the dashboard.
chipx86
  1. Awesome :) Only a couple things.
  2. trunk/reviewboard/reviews/views.py (Diff revision 1)
     
     
     
     
     
    Cute hack. I feel we should move it out of here, though, as it could be useful later.
    1. Eh, I'd rather wait.  What we're doing in the dashboard for the incoming
      view is pretty bad from a database performance standpoint (we're really
      only saved from being totally crunked up by the fact that the db is
      filtering for status='P' here).  If we really end up having cause to do
      this same kind of hack elsewhere, we can move it to a common place.
    2. Fair enough.
  3. Can we change object_list to review_request_list? We can name this by setting template_object_name to "review_request" when creating the view.
  4. There's a group= parameter that's passed to the page when looking at review requests for a certain group. We need to pass this as well. We can probably just unconditionally set it, since it'll be empty if we're not in group mode, but it would look nicer to make it conditional.
    1. Done.  I don't think it's too terrible if it's always there,
      since it'll only be in the URL if they're looking at pages
      other than the first, which should hopefully never happen.
    2. Yeah. It's fine to leave it.
  5. 
      
chipx86
  1. Looks good. Ship it.
  2. 
      
Loading...