gadventures / django-fsm-admin

Mixin and template tags to integrate django-fsm transitions into the django admin.
Other
203 stars 95 forks source link

[RFC] Call model's validate_fsm_state_change via Form.is_valid #74

Open blueyed opened 7 years ago

blueyed commented 7 years ago

This allows for validation on the model level for a transition that is about to happen (via form.is_valid). Raising ValidationError via validate_fsm_state_change allows for Django handling it properly, instead for when the ValidationError would be raised from the transition function itself.

Ref: https://github.com/django/django/pull/9113 Ref: https://github.com/kmmbvnr/django-fsm/issues/120

blueyed commented 7 years ago

It might also be possible and better to just set a property on the instance, which then could be used in the models clean method.