1 from django
.apps
import AppConfig
, apps
2 from django
.db
.models
.signals
import post_save
5 def set_episode_state(sender
, **kwargs
):
6 """ Updates the episode state with the saved EpisodeHistoryEntry """
8 from mygpo
.episodestates
.tasks
import update_episode_state
9 historyentry
= kwargs
.get('instance', None)
14 update_episode_state
.delay(historyentry
.pk
)
17 class EpisodeStatesConfig(AppConfig
):
18 name
= 'mygpo.episodestates'
19 verbose_name
= 'Episode States'
22 EpisodeHistoryEntry
= apps
.get_model('history.EpisodeHistoryEntry')
23 post_save
.connect(set_episode_state
, sender
=EpisodeHistoryEntry
)