Support ConditionChoices instances in ConditionsField and add typing.

Review Request #14272 — Created Dec. 15, 2024 and submitted — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

ConditionsField claimed support for taking a ConditionChoices class
or a callable returning the class, but not an instance. We have call
sites that passed in a class accordingly. The problem with prioritizing
classes is that there's no ability for code to register choices into a
ConditionChoices after construction (say, for extensions).

In practice, this field supported instances just fine, and we even had
unit tests for it, but we now document this explicitly (fixing class
names in the process).

The field has also been updated with typing, signature matches, and
some code cleanup.

Unit tests pass.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Support ConditionChoices instances in ConditionsField and add typing.
`ConditionsField` claimed support for taking a `ConditionChoices` class or a callable returning the class, but not an instance. We have call sites that passed in a class accordingly. The problem with prioritizing classes is that there's no ability for code to register choices into a `ConditionChoices` after construction (say, for extensions). In practice, this field supported instances just fine, and we even had unit tests for it, but we now document this explicitly (fixing class names in the process). The field has also been updated with typing and some code cleanup.
5477edf02df93762c2f04e3dc9e0b1a29d66878a Christian Hammond
djblets/forms/fields.py
Loading...