rsinger86/django-lifecycle

Feature request: Trigger method when *all* fields have been updated.

Closed this issue · 2 comments

Today we have a very useful kwarg, when_any:

when_any List[str] Similar to the when parameter, but takes a list of field names. The hooked method will fire if any of the corresponding fields meet the keyword conditions. Useful if you don't like stacking decorators.

I'd love to see a new kwarg, named when_all also accepting List[str] but instead of any of the fields needing to be affected, all fields should need to be updated in order for the method to run. Thus:

when_all List[str] Similar to the when parameter, but takes a list of field names. The hooked method will fire if all of the corresponding fields meet the keyword conditions.

TYIA

That could be useful to avoid having multiple stacked decorators. Are you willing to implement it?

That could be useful to avoid having multiple stacked decorators. Are you willing to implement it?

I'm putting it on my todo-list, but I won't have time for the next couple of weeks (at least).