'Checks the instance\'s module_type, and creates & saves a
StudentModuleHistoryExtended entry if the module_type is one that
we save.'

def save_history(sender, instance, **kwargs):

    if (instance.module_type in StudentModuleHistory.HISTORY_SAVING_TYPES):
        history_entry = StudentModuleHistory(student_module=instance, version=None, created=instance.modified, state=instance.state, grade=instance.grade, max_grade=instance.max_grade)
        history_entry.save()
