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

Commit

Permalink
[admin] Fixed VPN context in preview #57
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nemesifier committed May 24, 2017
1 parent ddee69d commit 7a5dad9
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -8,6 +8,9 @@ django.jQuery(function($) {
fields = $(selectors, '#content-main form').not('#id_config_jsoneditor *'), fields = $(selectors, '#content-main form').not('#id_config_jsoneditor *'),
$id = $('#id_id'), $id = $('#id_id'),
data = {}; data = {};
// add id to POST data
// note: may be overridden by fields of OneToOne relation
if ($id.length) { data['id'] = $id.val() }
// gather data to send in POST // gather data to send in POST
fields.each(function(i, field){ fields.each(function(i, field){
var $field = $(field), var $field = $(field),
Expand All @@ -23,8 +26,6 @@ django.jQuery(function($) {
} }
data[name] = $field.val(); data[name] = $field.val();
}); });
// add id to POST data
if ($id.length) { data['id'] = $id.val() }
// show preview // show preview
$.post(preview_url, data, function(html){ $.post(preview_url, data, function(html){
inner.html($('#content-main div', html).html()); inner.html($('#content-main div', html).html());
Expand Down

0 comments on commit 7a5dad9

Please sign in to comment.