diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 881ad28c72a..79fb865df3b 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -976,7 +976,7 @@ class ConsolePortConnectionForm(BootstrapMixin, forms.ModelForm): queryset=ConsoleServerPort.objects.all(), label='Port', widget=APISelect( - api_url='/api/dcim/console-server-ports/?device_id={{device}}', + api_url='/api/dcim/console-server-ports/?device_id={{console_server}}', disabled_indicator='connected_console', ) ) @@ -1244,7 +1244,7 @@ class PowerPortConnectionForm(BootstrapMixin, forms.ModelForm): queryset=PowerOutlet.objects.all(), label='Outlet', widget=APISelect( - api_url='/api/dcim/power-outlets/?device_id={{device}}', + api_url='/api/dcim/power-outlets/?device_id={{pdu}}', disabled_indicator='connected_port' ) ) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 9b0d41065de..15755cbe9aa 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -11,6 +11,7 @@ from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse +from django.utils.html import escape from django.utils.http import urlencode from django.utils.safestring import mark_safe from django.views.generic import View diff --git a/netbox/extras/models.py b/netbox/extras/models.py index 06ed07b8505..62eb07d1a06 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -383,7 +383,7 @@ def image_upload(instance, filename): elif instance.name: filename = instance.name - return '{}{}_{}_{}'.format(path, instance.content_type.name, instance.object_id, filename) + return u'{}{}_{}_{}'.format(path, instance.content_type.name, instance.object_id, filename) @python_2_unicode_compatible diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index a35fea83e2e..861c618cd82 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -13,7 +13,7 @@ ) -VERSION = '2.0.0' +VERSION = '2.0.1' # Import local configuration ALLOWED_HOSTS = DATABASE = SECRET_KEY = None diff --git a/netbox/netbox/views.py b/netbox/netbox/views.py index 6aec8970189..8e42086bcc5 100644 --- a/netbox/netbox/views.py +++ b/netbox/netbox/views.py @@ -191,7 +191,7 @@ def get(self, request): results.append({ 'name': queryset.model._meta.verbose_name_plural, 'table': table, - 'url': '{}?q={}'.format(reverse(url), form.cleaned_data['q']) + 'url': u'{}?q={}'.format(reverse(url), form.cleaned_data['q']) }) return render(request, 'search.html', { diff --git a/netbox/project-static/js/secrets.js b/netbox/project-static/js/secrets.js index da5e52b74f7..89326ff1520 100644 --- a/netbox/project-static/js/secrets.js +++ b/netbox/project-static/js/secrets.js @@ -16,13 +16,14 @@ $(document).ready(function() { // Adding/editing a secret $('form').submit(function(event) { - if ( - $(this).find('input.requires-session-key').filter(function() {return this.value == ""}) && - document.cookie.indexOf('session_key') == -1 - ) { - $('#privkey_modal').modal('show'); - event.preventDefault(); - } + $(this).find('input.requires-session-key').each(function() { + if (this.value && document.cookie.indexOf('session_key') == -1) { + console.log('Field ' + this.value + ' requires a session key'); + $('#privkey_modal').modal('show'); + event.preventDefault(); + return false; + } + }); }); // Retrieve a session key