Use .set() when assigning multiple relations.

Review Request #11989 — Created Jan. 24, 2022 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

Using the assignment operator for setting the far side of a relation
such as ManyToManyField or ForeignKey now generates an error
instructing us to use .set() instead.

In many cases, we were using .set() to set a list of relations on
newly-created objects within tests. In these cases, we can save one
query per use by using .add() instead.

Ran unit tests.

Commits

Files

    Loading...