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.

Changes between revision 1 and 2

orig
1
2
3

Commits

Summary ID Author
Use .set() when assigning multiple relations.
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. This is a relatively straightforward update. Testing Done: Ran unit tests.
a06e10626df204c34ea172234458e8355dea536e David Trowbridge
Use .set() when assigning multiple relations.
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. This is a relatively straightforward update. Testing Done: Ran unit tests.
d830b7b3ea93f8daa4a7b54dea5973ab4ebaeafa David Trowbridge
reviewboard/reviews/tests/test_review_request_draft.py
Loading...