From 6406e213bdcc0c5babf221d70293fe2270f78961 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 5 Mar 2019 13:15:09 -0500 Subject: [PATCH] Fixes #2961: Prevent exception when exporting inventory items belonging to unnamed devices --- CHANGELOG.md | 1 + netbox/dcim/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a436d546..89634c1c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ v2.5.8 (FUTURE) * [#2939](https://github.com/digitalocean/netbox/issues/2939) - Exclude circuit terminations from API interface connections endpoint * [#2952](https://github.com/digitalocean/netbox/issues/2952) - Added the `slug` field to the Tenant filter for use in the API and search function * [#2954](https://github.com/digitalocean/netbox/issues/2954) - Remove trailing slashes to fix root/template paths on Windows +* [#2961](https://github.com/digitalocean/netbox/issues/2961) - Prevent exception when exporting inventory items belonging to unnamed devices * [#2962](https://github.com/digitalocean/netbox/issues/2962) - Increase ExportTemplate `mime_type` field length --- diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 49879beb1..8133cbfb4 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -2423,7 +2423,7 @@ class InventoryItem(ComponentModel): def to_csv(self): return ( - self.device.name or '{' + self.device.pk + '}', + self.device.name or '{{{}}}'.format(self.device.pk), self.name, self.manufacturer.name if self.manufacturer else None, self.part_id,