From 82ab4dbffb65f4e22a290f4de241d0909133dd6d Mon Sep 17 00:00:00 2001 From: natecohen <94263748+natecohen@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:51:32 -0400 Subject: [PATCH] Fix NoneType encode error when rendering VM panels Move the invocation of `get_context()` to the beginning of render methods --- netbox_lifecycle/template_content.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/netbox_lifecycle/template_content.py b/netbox_lifecycle/template_content.py index 820e220..27f99c6 100644 --- a/netbox_lifecycle/template_content.py +++ b/netbox_lifecycle/template_content.py @@ -125,6 +125,8 @@ def _render_contract_card(self, location=None): if self.get_contract_card_position() != location: return '' + context = self.get_context(self.context) + title = _('Contracts') action = [ actions.AddObject( @@ -159,7 +161,6 @@ def _render_contract_card(self, location=None): filter = { self.field_name: lambda ctx: ctx['object'].pk, } - context = self.get_context(self.context) panel = TabbedTablePanel( title=title, tabs={ @@ -209,6 +210,8 @@ def _render_license_card(self, location=None, exclude=None, include=None): if self.get_license_card_position() != location: return '' + context = self.get_context(self.context) + action = [ actions.AddObject( 'netbox_lifecycle.LicenseAssignment', @@ -218,7 +221,6 @@ def _render_license_card(self, location=None, exclude=None, include=None): ), ] - context = self.get_context(self.context) panel = panels.ObjectsTablePanel( title=_('Licenses'), model='netbox_lifecycle.licenseassignment',