mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-17 12:42:52 -06:00
commit
1bbfc6da25
@ -1,5 +1,13 @@
|
|||||||
# NetBox v2.9
|
# NetBox v2.9
|
||||||
|
|
||||||
|
## v2.9.7 (2020-10-12)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#5231](https://github.com/netbox-community/netbox/issues/5231) - Fix KeyError exception when viewing object with custom link and debugging is disabled
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## v2.9.6 (2020-10-09)
|
## v2.9.6 (2020-10-09)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
@ -33,7 +33,7 @@ def custom_links(context, obj):
|
|||||||
# Pass select context data when rendering the CustomLink
|
# Pass select context data when rendering the CustomLink
|
||||||
link_context = {
|
link_context = {
|
||||||
'obj': obj,
|
'obj': obj,
|
||||||
'debug': context['debug'], # django.template.context_processors.debug
|
'debug': context.get('debug', False), # django.template.context_processors.debug
|
||||||
'request': context['request'], # django.template.context_processors.request
|
'request': context['request'], # django.template.context_processors.request
|
||||||
'user': context['user'], # django.contrib.auth.context_processors.auth
|
'user': context['user'], # django.contrib.auth.context_processors.auth
|
||||||
'perms': context['perms'], # django.contrib.auth.context_processors.auth
|
'perms': context['perms'], # django.contrib.auth.context_processors.auth
|
||||||
|
@ -2,11 +2,13 @@ import urllib.parse
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.test import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from dcim.models import Site
|
from dcim.models import Site
|
||||||
from extras.choices import ObjectChangeActionChoices
|
from extras.choices import ObjectChangeActionChoices
|
||||||
from extras.models import ConfigContext, ObjectChange, Tag
|
from extras.models import ConfigContext, CustomLink, ObjectChange, Tag
|
||||||
from utilities.testing import ViewTestCases, TestCase
|
from utilities.testing import ViewTestCases, TestCase
|
||||||
|
|
||||||
|
|
||||||
@ -124,3 +126,24 @@ class ObjectChangeTestCase(TestCase):
|
|||||||
objectchange = ObjectChange.objects.first()
|
objectchange = ObjectChange.objects.first()
|
||||||
response = self.client.get(objectchange.get_absolute_url())
|
response = self.client.get(objectchange.get_absolute_url())
|
||||||
self.assertHttpStatus(response, 200)
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
|
class CustomLinkTest(TestCase):
|
||||||
|
user_permissions = ['dcim.view_site']
|
||||||
|
|
||||||
|
def test_view_object_with_custom_link(self):
|
||||||
|
customlink = CustomLink(
|
||||||
|
content_type=ContentType.objects.get_for_model(Site),
|
||||||
|
name='Test',
|
||||||
|
text='FOO {{ obj.name }} BAR',
|
||||||
|
url='http://example.com/?site={{ obj.slug }}',
|
||||||
|
new_window=False
|
||||||
|
)
|
||||||
|
customlink.save()
|
||||||
|
|
||||||
|
site = Site(name='Test Site', slug='test-site')
|
||||||
|
site.save()
|
||||||
|
|
||||||
|
response = self.client.get(site.get_absolute_url(), follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertIn(f'FOO {site.name} BAR', str(response.content))
|
||||||
|
@ -16,7 +16,7 @@ from django.core.validators import URLValidator
|
|||||||
# Environment setup
|
# Environment setup
|
||||||
#
|
#
|
||||||
|
|
||||||
VERSION = '2.9.6'
|
VERSION = '2.9.7'
|
||||||
|
|
||||||
# Hostname
|
# Hostname
|
||||||
HOSTNAME = platform.node()
|
HOSTNAME = platform.node()
|
||||||
|
Loading…
Reference in New Issue
Block a user