Browse Source

Closes #3515: Enable export templates for inventory items

Jeremy Stretch 6 years ago
parent
commit
b7b04045de
3 changed files with 10 additions and 3 deletions
  1. 1 0
      CHANGELOG.md
  2. 1 0
      netbox/extras/constants.py
  3. 8 3
      netbox/extras/models.py

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ v2.6.5 (FUTURE)
 * [#3297](https://github.com/netbox-community/netbox/issues/3297) -  Include reserved units when calculating rack utilization
 * [#3297](https://github.com/netbox-community/netbox/issues/3297) -  Include reserved units when calculating rack utilization
 * [#3347](https://github.com/netbox-community/netbox/issues/3347) -  Extend upgrade script to automatically remove stale content types
 * [#3347](https://github.com/netbox-community/netbox/issues/3347) -  Extend upgrade script to automatically remove stale content types
 * [#3352](https://github.com/netbox-community/netbox/issues/3352) -  Enable filtering changelog API by `changed_object_id`
 * [#3352](https://github.com/netbox-community/netbox/issues/3352) -  Enable filtering changelog API by `changed_object_id`
+* [#3515](https://github.com/netbox-community/netbox/issues/3515) -  Enable export templates for inventory items
 * [#3524](https://github.com/netbox-community/netbox/issues/3524) -  Enable bulk editing of power outlet/power port associations
 * [#3524](https://github.com/netbox-community/netbox/issues/3524) -  Enable bulk editing of power outlet/power port associations
 * [#3529](https://github.com/netbox-community/netbox/issues/3529) -  Enable filtering circuits list by region
 * [#3529](https://github.com/netbox-community/netbox/issues/3529) -  Enable filtering circuits list by region
 
 

+ 1 - 0
netbox/extras/constants.py

@@ -107,6 +107,7 @@ EXPORTTEMPLATE_MODELS = [
     'dcim.device',
     'dcim.device',
     'dcim.devicetype',
     'dcim.devicetype',
     'dcim.interface',
     'dcim.interface',
+    'dcim.inventoryitem',
     'dcim.manufacturer',
     'dcim.manufacturer',
     'dcim.powerpanel',
     'dcim.powerpanel',
     'dcim.powerport',
     'dcim.powerport',

+ 8 - 3
netbox/extras/models.py

@@ -435,14 +435,19 @@ class ExportTemplate(models.Model):
         choices=TEMPLATE_LANGUAGE_CHOICES,
         choices=TEMPLATE_LANGUAGE_CHOICES,
         default=TEMPLATE_LANGUAGE_JINJA2
         default=TEMPLATE_LANGUAGE_JINJA2
     )
     )
-    template_code = models.TextField()
+    template_code = models.TextField(
+        help_text='The list of objects being exported is passed as a context variable named <code>queryset</code>.'
+    )
     mime_type = models.CharField(
     mime_type = models.CharField(
         max_length=50,
         max_length=50,
-        blank=True
+        blank=True,
+        verbose_name='MIME type',
+        help_text='Defaults to <code>text/plain</code>'
     )
     )
     file_extension = models.CharField(
     file_extension = models.CharField(
         max_length=15,
         max_length=15,
-        blank=True
+        blank=True,
+        help_text='Extension to append to the rendered filename'
     )
     )
 
 
     class Meta:
     class Meta: