File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
apps/system_manage/migrations Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ def get_initialization_resource_mapping():
1616 from application .models import Application
1717 from knowledge .models import KnowledgeWorkflow
1818 from application .flow .tools import application_instance_field_call_dict , knowledge_instance_field_call_dict
19+ from application .models .application import ApplicationKnowledgeMapping
20+ from system_manage .models .resource_mapping import ResourceMapping
1921 resource_mapping_list = []
2022 ids = list (Application .objects .values_list ('id' , flat = True ))
2123 for app_id in ids :
@@ -47,8 +49,13 @@ def get_initialization_resource_mapping():
4749 resource_mapping_list += instance_mapping
4850 except :
4951 pass
50-
51- return resource_mapping_list
52+ application_knowledge_mapping = [
53+ ResourceMapping (source_type = ResourceType .APPLICATION , target_type = ResourceType .KNOWLEDGE ,
54+ source_id = str (akm .application_id ), target_id = str (akm .knowledge_id )) for akm in
55+ QuerySet (ApplicationKnowledgeMapping ).all ()]
56+ resource_mapping_list += application_knowledge_mapping
57+ return {(str (item .target_type ) + str (item .target_id ) + str (item .source_type ) + str (item .source_id )): item for item
58+ in resource_mapping_list }.values ()
5259
5360
5461def resource_mapping (apps , schema_editor ):
You can’t perform that action at this time.
0 commit comments