Update the diffviewer.admin module for better performance and compatibility.

Review Request #10842 — Created Jan. 21, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

When DVCS was implemented, the diffviewer model gained a lot of new
models, and with those came ModelAdmin and InlineModelAdmin
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
both the ModelAdmin and InlineModelAdmin for each model type into
private _*Common classes, 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 diff and parent_diff
fields for display of a FileDiff, removing allow_tags and replacing
with a return of SafeText for each. This will be needed eventually for
Django 2.0+.

I also found that we were setting the label attribute on both of
these, which doesn't exist. short_description was the correct
attribute to set, which we're now setting.

Tested on Django 1.6 and 1.11 with viewing a FileDiff, DiffSet,
and DiffCommit.

Commits

Files

    Loading...