Permalink
Browse files

[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
  • Loading branch information...
nemesisdesign committed May 24, 2017
1 parent ddee69d commit 7a5dad9f97e708b89149c2765f8298c5a94b652b
Showing with 3 additions and 2 deletions.
  1. +3 −2 django_netjsonconfig/static/django-netjsonconfig/js/preview.js
@@ -8,6 +8,9 @@ django.jQuery(function($) {
fields = $(selectors, '#content-main form').not('#id_config_jsoneditor *'),
$id = $('#id_id'),
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
fields.each(function(i, field){
var $field = $(field),
@@ -23,8 +26,6 @@ django.jQuery(function($) {
}
data[name] = $field.val();
});
// add id to POST data
if ($id.length) { data['id'] = $id.val() }
// show preview
$.post(preview_url, data, function(html){
inner.html($('#content-main div', html).html());

0 comments on commit 7a5dad9

Please sign in to comment.