Fix rendering the admin sidebar when in an extension's database views.
Review Request #11497 — Created March 1, 2021 and submitted
When accessing an extension's database views (such as Review Bot's
Tools entries), URL lookups for pages in Review Board's main database
pages would fail to resolve, breaking rendering of the page.This happens due to the usage of the
current_appsupport in URL
rendering. This is a method that's used to limit which URLs may be
matched when resolving a URL. Ifrequest.current_appis set in a view
(which is the case for any givenAdminSite), then any calls to
{% url %}will pass it in toreverse().In this particular case, reversing
admin:XYZwith a
current_app='test'would match only intest'sadmin:...URLs, and
would fail to find anadmin:XYZin some other app.The solution in our case is to precompute the URLs before rendering the
template, letting us bypass thecurrent_appmechanism. This is being
done in the{% admin_sidebar %}template tag, which handles the
rendering.
Accessed the Review Bot database views. The pages rendered correctly,
and all sidebar links worked.Tested the main admin UI pages. They also worked correctly.
| Summary | ID | 
|---|---|
| d098392210e49930220bbead3565c034c2166d25 |