Update the diffviewer.admin module for better performance and compatibility.
Review Request #10842 — Created Jan. 21, 2020 and submitted
When DVCS was implemented, the
diffviewermodel gained a lot of new
models, and with those came
definitions. Many of these were making use of the default dropdown
fields for relations, which wouldn't scale in production. To solve that,
we needed to add more fields to
raw_id_fields. On top of that, we
never actually had this set for the inlines, meaning we needed to do
that there as well.
This change takes the approach of defining all the attributes common to
InlineModelAdminfor each model type into
_*Commonclasses, and then mixing them in to both classes for
the model. This ensures we don't regress in the inlines, and speeds up
loading all around.
It also implements some future-proofing for the
fields for display of a
with a return of
SafeTextfor each. This will be needed eventually for
I also found that we were setting the
labelattribute on both of
these, which doesn't exist.
short_descriptionwas the correct
attribute to set, which we're now setting.
Tested on Django 1.6 and 1.11 with viewing a