def create_channels_for_related_fields_in_model(model_class):
    """
    Create channel for the fields of the model, the channel name can be got by calling get_ajax_config_for_relation_fields
    :param model_class:
    :return:
    """
    need_to_create_channel = []
    for field in enum_model_fields(model_class):
        if type(field) in get_relation_field_types():
            if field.related_model == 'self':
                need_to_create_channel.append(model_class)
            elif field.related_field.model not in need_to_create_channel:
                need_to_create_channel.append(field.related_field.model)

    for field in enum_model_many_to_many(model_class):
        if type(field) in get_relation_field_types():
            if field.related_model not in need_to_create_channel:
                need_to_create_channel.append(field.related_model)

    for field_model_class in need_to_create_channel:
        if class_name_to_low_case(field_model_class.__name__) not in registry._registry:
            register_channel(field_model_class)
def create_channels_for_related_fields_in_model ( model_class ) : need_to_create_channel = [ ] for field in enum_model_fields ( model_class ) : if type ( field ) in get_relation_field_types ( ) : if field . related_model == 'self' : need_to_create_channel . append ( model_class ) elif field . related_field . model not in need_to_create_channel : need_to_create_channel . append ( field . related_field . model ) for field in enum_model_many_to_many ( model_class ) : if type ( field ) in get_relation_field_types ( ) : if field . related_model not in need_to_create_channel : need_to_create_channel . append ( field . related_model ) for field_model_class in need_to_create_channel : if class_name_to_low_case ( field_model_class . __name__ ) not in registry . _registry : register_channel ( field_model_class )
Create channel for the fields of the model, the channel name can be got by calling get_ajax_config_for_relation_fields
    :param model_class:
    :return: