Fix links to child resources of review requests and to draft screenshots.

Review Request #2336 — Created May 4, 2011 and submitted

Information

Review Board
master

Reviewers

Fix links to child resources of review requests and to draft screenshots.

Links on resources were pretty busted due to review requests sometimes
being represented by database ID and sometimes by local ID. Fixing this
unmasked some regressions with screenshots that are part of drafts.

There are four main components here:

1) ReviewRequestResource now uses display_id as the ID field, instead of
   the default of "pk". While we would have the display ID appear as the
   ID for a review request's resource, and even some links to children,
   we would still use pk when building a path up the parent chain.

2) The get_href() overrides have been removed in the resources, since
   #1 above takes care of the problem and link generation works as would
   be expected. This simplifies things, and unmasks the problem for #3.

3) Screenshot resources weren't really being placed properly. Since
   screenshots that are part of drafts only no longer have the
   review_request field set to anything, the parent object accessors
   would fail. Really, a screenshot can have three ways of accessing
   the parent review request: Through review_request, inactive_review_request,
   or draft.review_request. get_object_parent() now uses
   screenshot.get_review_request(), which tries all the possibilities,
   fixing links and requests.

4) Drafts weren't being fetched correctly, and would return 404s when
   they shouldn't have.

With these four fixes, we no longer have the comment duplication bug.

It also fixes setting draft screenshot captions. Displaying them requires
a couple other fixes, which I will put into a different change.
* Unit tests all pass.
* Verified that resources I couldn't access can now be accessed.
* Verified that incorrect links in some resources on localsites are now correct.
* Couldn't reproduce the duplicate comment bug anymore.