Add compatibility with relation field attribute changes in Django 1.9+.
Review Request #10266 — Created Oct. 23, 2018 and submitted
Django 1.9 replaced
Field.rel
withField.remote_field
, along with a
handful of other attributes, as part of an effort to provide a
supported, documented API for field relations.This change adds compatibility with both the old undocumented API and
the new documented API through the addition ofget_remote_field()
and
get_remote_field_model()
functions. These are used instead of
.rel
/.rel.to
and.remote_field
/.remote_field.model
accessors.
Unit tests pass on Django 1.6 through 1.11, and 2.1 with additional
changes.