Skip to content
This repository was archived by the owner on Jul 9, 2020. It is now read-only.

Commit 7a5dad9

Browse files
committed
[admin] Fixed VPN context in preview #57
Fortunately it was just a frontend JS issue. The preview instance was getting the UUID of the Device object instead of the Config object, and that prevented the system from finding the associated VPN and fill the context VPN keys correctly. Fixes #57
1 parent ddee69d commit 7a5dad9

File tree

1 file changed

+3
-2
lines changed
  • django_netjsonconfig/static/django-netjsonconfig/js

1 file changed

+3
-2
lines changed

django_netjsonconfig/static/django-netjsonconfig/js/preview.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ django.jQuery(function($) {
88
fields = $(selectors, '#content-main form').not('#id_config_jsoneditor *'),
99
$id = $('#id_id'),
1010
data = {};
11+
// add id to POST data
12+
// note: may be overridden by fields of OneToOne relation
13+
if ($id.length) { data['id'] = $id.val() }
1114
// gather data to send in POST
1215
fields.each(function(i, field){
1316
var $field = $(field),
@@ -23,8 +26,6 @@ django.jQuery(function($) {
2326
}
2427
data[name] = $field.val();
2528
});
26-
// add id to POST data
27-
if ($id.length) { data['id'] = $id.val() }
2829
// show preview
2930
$.post(preview_url, data, function(html){
3031
inner.html($('#content-main div', html).html());

0 commit comments

Comments
 (0)