5monkeys / django-enumfield

Custom Django field for using enumerations of named constants
MIT License
204 stars 46 forks source link

Hooking into transitions #78

Open CodeWithOz opened 1 year ago

CodeWithOz commented 1 year ago

Is there any functionality to hook into transitions and execute some logic when the transition occurs?

Swamii commented 1 year ago

Hello. No, it's not possible to hook into the actual transition on a database/model layer. You could override this method to possibly execute something when we check if a transition is possible https://github.com/5monkeys/django-enumfield/blob/master/django_enumfield/enum.py#L213 - but that method can be called from many places.