1010
1111from .. import settings as app_settings
1212from ..contextmanagers import log_failure
13+ from ..visualizer import GraphVisualizerUrls
1314
1415
1516class TimeStampedEditableAdmin (ModelAdmin ):
@@ -37,7 +38,7 @@ class Media:
3738 static ('netjsongraph/js/visualize.js' )]
3839
3940
40- class AbstractTopologyAdmin (BaseAdmin , ReceiveUrlAdmin ):
41+ class AbstractTopologyAdmin (BaseAdmin , ReceiveUrlAdmin , GraphVisualizerUrls ):
4142 list_display = ['label' , 'parser' , 'strategy' , 'published' , 'created' , 'modified' ]
4243 readonly_fields = ['protocol' , 'version' , 'revision' , 'metric' , 'receive_url' ]
4344 list_filter = ['parser' , 'strategy' ]
@@ -47,8 +48,8 @@ class AbstractTopologyAdmin(BaseAdmin, ReceiveUrlAdmin):
4748 'expiration_time' , 'receive_url' , 'published' , 'protocol' ,
4849 'version' , 'revision' , 'metric' , 'created' ]
4950 receive_url_name = 'receive_topology'
50- receive_url_urlconf = app_settings .TOPOLOGY_RECEIVE_URLCONF
51- receive_url_baseurl = app_settings .TOPOLOGY_RECEIVE_BASEURL
51+ receive_url_urlconf = app_settings .TOPOLOGY_API_URLCONF
52+ receive_url_baseurl = app_settings .TOPOLOGY_API_BASEURL
5253
5354 def get_actions (self , request ):
5455 """
@@ -135,8 +136,7 @@ def unpublish_selected(self, request, queryset):
135136 unpublish_selected .short_description = _ ('Unpublish selected items' )
136137
137138 def visualize_view (self , request , pk ):
138- graph_url = reverse ('network_graph' , args = [pk ])
139- history_url = reverse ('network_graph_history' , args = [pk ])
139+ graph_url , history_url = self .get_graph_urls (request , pk )
140140 context = self .admin_site .each_context (request )
141141 opts = self .model ._meta
142142 context .update ({
0 commit comments