@@ -449,31 +449,24 @@ def get_action_urls(self, js_compat=True):
449
449
This method replaces the set of legacy methods `get_add_url`, ``get_edit_url`, `get_move_url`,
450
450
`get_delete_url`, `get_copy_url`.
451
451
"""
452
- if not hasattr (CMSPlugin , '_edit_url' ):
453
- CMSPlugin ._edit_url = admin_reverse ('cms_placeholder_edit_plugin' , args = (0 ,))
454
- CMSPlugin ._add_url = admin_reverse ('cms_placeholder_add_plugin' )
455
- CMSPlugin ._delete_url = admin_reverse ('cms_placeholder_delete_plugin' , args = (0 ,))
456
- CMSPlugin ._move_url = admin_reverse ('cms_placeholder_move_plugin' )
457
- CMSPlugin ._copy_url = admin_reverse ('cms_placeholder_copy_plugins' )
458
-
459
452
if js_compat :
460
453
# TODO: Remove this condition
461
454
# once the javascript files have been refactored
462
455
# to use the new naming schema (ending in _url).
463
456
return {
464
- 'edit_plugin' : re . sub ( r"/0/" , f"/ { self .pk } /" , CMSPlugin . _edit_url ),
465
- 'add_plugin' : CMSPlugin . _add_url ,
466
- 'delete_plugin' : re . sub ( r"/0/" , f"/ { self .pk } /" , CMSPlugin . _delete_url ),
467
- 'move_plugin' : CMSPlugin . _move_url ,
468
- 'copy_plugin' : CMSPlugin . _copy_url ,
457
+ 'edit_plugin' : admin_reverse ( 'cms_placeholder_edit_plugin' , args = ( self .pk ,) ),
458
+ 'add_plugin' : admin_reverse ( 'cms_placeholder_add_plugin' ) ,
459
+ 'delete_plugin' : admin_reverse ( 'cms_placeholder_delete_plugin' , args = ( self .pk ,) ),
460
+ 'move_plugin' : admin_reverse ( 'cms_placeholder_move_plugin' ) ,
461
+ 'copy_plugin' :admin_reverse ( 'cms_placeholder_copy_plugins' ) ,
469
462
}
470
463
else :
471
464
return {
472
- 'edit_url' : re . sub ( r"/0/" , f"/ { self .pk } /" , CMSPlugin . _edit_url ),
473
- 'add_url' : CMSPlugin . _add_url ,
474
- 'delete_url' : re . sub ( r"/0/" , f"/ { self .pk } /" , CMSPlugin . _delete_url ),
475
- 'move_url' : CMSPlugin . _move_url ,
476
- 'copy_url' : CMSPlugin . _copy_url ,
465
+ 'edit_url' : admin_reverse ( 'cms_placeholder_edit_plugin' , args = ( self .pk ,) ),
466
+ 'add_url' : admin_reverse ( 'cms_placeholder_add_plugin' ) ,
467
+ 'delete_url' : admin_reverse ( 'cms_placeholder_delete_plugin' , args = ( self .pk ,) ),
468
+ 'move_url' : admin_reverse ( 'cms_placeholder_move_plugin' ) ,
469
+ 'copy_url' : admin_reverse ( 'cms_placeholder_copy_plugins' ) ,
477
470
}
478
471
479
472
0 commit comments