1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Update models.py

Change default MIME-Type as discussed under #12095
This commit is contained in:
gdprdatasubect
2023-03-30 17:19:55 +02:00
committed by Jeremy Stretch
parent 6f08c4a4be
commit fbc23424a6

View File

@ -301,7 +301,7 @@ class ExportTemplate(CloningMixin, ExportTemplatesMixin, WebhooksMixin, ChangeLo
max_length=50,
blank=True,
verbose_name='MIME type',
help_text=_('Defaults to <code>text/plain</code>')
help_text=_('Defaults to <code>text/plain; charset=utf-8</code>')
)
file_extension = models.CharField(
max_length=15,
@ -357,7 +357,7 @@ class ExportTemplate(CloningMixin, ExportTemplatesMixin, WebhooksMixin, ChangeLo
Render the template to an HTTP response, delivered as a named file attachment
"""
output = self.render(queryset)
mime_type = 'text/plain' if not self.mime_type else self.mime_type
mime_type = 'text/plain; charset=utf-8' if not self.mime_type else self.mime_type
# Build the response
response = HttpResponse(output, content_type=mime_type)