File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
openwisp_controller/config/static/config/js Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,14 @@ django.jQuery(function ($) {
73
73
var value = templates . join ( "," ) ,
74
74
templateField = templatesFieldName ( ) ;
75
75
$ ( `input[name="${ templateField } "]` ) . attr ( "value" , value ) ;
76
- if ( pageLoading ) {
76
+ if (
77
+ pageLoading ||
78
+ // Handle cases where the AJAX request finishes after initial page load.
79
+ // If we're editing an existing object and the initial value hasn't been set,
80
+ // assign it now to avoid false positives in the unsaved changes warning.
81
+ ( ! isAddingNewObject ( ) &&
82
+ django . _owcInitialValues [ templateField ] === undefined )
83
+ ) {
77
84
django . _owcInitialValues [ templateField ] = value ;
78
85
}
79
86
$ ( "input.sortedm2m:first" ) . trigger ( "change" ) ;
You can’t perform that action at this time.
0 commit comments