Jeremy Stretch 4 лет назад
Родитель
Сommit
0eb9f41470

+ 2 - 0
docs/additional-features/export-templates.md

@@ -21,6 +21,8 @@ Height: {{ rack.u_height }}U
 
 To access custom fields of an object within a template, use the `cf` attribute. For example, `{{ obj.cf.color }}` will return the value (if any) for a custom field named `color` on `obj`.
 
+The `as_attachment` attribute of an export template controls its behavior when rendered. If true, the rendered content will be returned to the user as a downloadable file. If false, it will be displayed within the browser. (This may be handy e.g. for generating HTML content.)
+
 A MIME type and file extension can optionally be defined for each export template. The default MIME type is `text/plain`.
 
 ## Example

+ 3 - 0
docs/release-notes/version-2.11.md

@@ -93,6 +93,7 @@ A new Cloud model has been introduced to represent the boundary of a network tha
 * [#5451](https://github.com/netbox-community/netbox/issues/5451) - Add support for multiple-selection custom fields
 * [#5608](https://github.com/netbox-community/netbox/issues/5608) - Add REST API endpoint for custom links
 * [#5610](https://github.com/netbox-community/netbox/issues/5610) - Add REST API endpoint for webhooks
+* [#5830](https://github.com/netbox-community/netbox/issues/5830) - Add `as_attachment` to ExportTemplate to control download behavior
 * [#5891](https://github.com/netbox-community/netbox/issues/5891) - Add `display` field to all REST API serializers
 * [#5894](https://github.com/netbox-community/netbox/issues/5894) - Use primary keys when filtering object lists by related objects in the UI
 * [#5895](https://github.com/netbox-community/netbox/issues/5895) - Rename RackGroup to Location
@@ -149,6 +150,8 @@ A new Cloud model has been introduced to represent the boundary of a network tha
   * Added new custom field type: `multi-select`
 * extras.CustomLink
   * Added the `/api/extras/custom-links/` endpoint
+* extras.ExportTemplate
+  * Added the `as_attachment` boolean field
 * extras.ObjectChange
   * Added the `prechange_data` field
   * Renamed `object_data` to `postchange_data`

+ 0 - 2
netbox/extras/migrations/0059_attachment_export_templates.py → netbox/extras/migrations/0059_exporttemplate_as_attachment.py

@@ -1,5 +1,3 @@
-# Generated by Django 3.2b1 on 2021-03-30 20:16
-
 from django.db import migrations, models