mozilla/zamboni — pull request #1123 by ngokevin (2013-09-12 00:25:29+00:00)
Title: refactor and fix queue sorting for name fields and pending queue (bug 890177)

**The regression:**

The pending apps review queue was switched over to use a Version queryset over a Webapp queryset.

Pending apps queue sorted as ```nomination``` but displayed as ```created```.

**The fix:**

Use ```order_by_translation``` on a ```values_list('addon')``` from the Version queryset.

**The refactor:**

- Create two separate sort functions, one for Webapps and one for non-Webapps.
- Have one sort function that determines which separate sort function to call based on the queryset model.
- Remove the ```_queue_to_apps``` function and integrate it into the sort non-Webapp sort function.

**The tests:**

Already existed but slightly changed to accommodate the refactor.

**The struggle:**

- Going 'bout it the wrong way, at first trying to manually use a double left join from Version to Translation field of the model.
- Then later saw I was converting the queryset from non-Webapps to Webapps back to Webapps.
- Hours wasted on running into a [django ORM bug](https://github.com/django/django/commit/2f35c6f10fcbae541691207fb0c0560a13b754fc)