File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed
openwisp_controller/config
templates/admin/device_group Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -105,10 +105,7 @@ django.jQuery(function ($) {
105
105
url . searchParams . set ( "backend" , backend ) ;
106
106
}
107
107
if ( isDeviceGroup ( ) && ! $ ( ".add-form" ) . length ) {
108
- // Get the group id from the URL
109
- // TODO: This is fragile, consider using a more robust way to get the group id.
110
- var pathParts = window . location . pathname . split ( "/" ) ;
111
- url . searchParams . set ( "group_id" , pathParts [ pathParts . length - 3 ] ) ;
108
+ url . searchParams . set ( "group_id" , window . _deviceGroupId ) ;
112
109
} else if ( $ ( 'input[name="config-0-id"]' ) . length ) {
113
110
url . searchParams . set ( "config_id" , $ ( 'input[name="config-0-id"]' ) . val ( ) ) ;
114
111
}
Original file line number Diff line number Diff line change 13
13
$ ( document ) . ready ( function ( ) {
14
14
window . _relevantTemplateUrl = "{{ relevant_template_url | safe }}" ;
15
15
window . _deviceGroup = true ;
16
+ window . _deviceGroupId = "{{ original.pk }}" ;
16
17
window . bindDefaultTemplateLoading ( ) ;
17
18
} )
18
19
} ) ( django . jQuery ) ;
You can’t perform that action at this time.
0 commit comments