mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #5830: Add as_attachment field to API serializers and admin view.
This commit is contained in:
@ -193,7 +193,7 @@ class ExportTemplateForm(forms.ModelForm):
|
|||||||
class ExportTemplateAdmin(admin.ModelAdmin):
|
class ExportTemplateAdmin(admin.ModelAdmin):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Export Template', {
|
('Export Template', {
|
||||||
'fields': ('content_type', 'name', 'description', 'mime_type', 'file_extension')
|
'fields': ('content_type', 'name', 'description', 'mime_type', 'file_extension', 'as_attachment')
|
||||||
}),
|
}),
|
||||||
('Content', {
|
('Content', {
|
||||||
'fields': ('template_code',),
|
'fields': ('template_code',),
|
||||||
@ -201,7 +201,7 @@ class ExportTemplateAdmin(admin.ModelAdmin):
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
list_display = [
|
list_display = [
|
||||||
'name', 'content_type', 'description', 'mime_type', 'file_extension',
|
'name', 'content_type', 'description', 'mime_type', 'file_extension', 'as_attachment',
|
||||||
]
|
]
|
||||||
list_filter = [
|
list_filter = [
|
||||||
'content_type',
|
'content_type',
|
||||||
|
@ -116,7 +116,7 @@ class ExportTemplateSerializer(ValidatedModelSerializer):
|
|||||||
model = ExportTemplate
|
model = ExportTemplate
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'content_type', 'name', 'description', 'template_code', 'mime_type',
|
'id', 'url', 'display', 'content_type', 'name', 'description', 'template_code', 'mime_type',
|
||||||
'file_extension',
|
'file_extension', 'as_attachment',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ class ExportTemplate(BigIDModel):
|
|||||||
)
|
)
|
||||||
as_attachment = models.BooleanField(
|
as_attachment = models.BooleanField(
|
||||||
default=True,
|
default=True,
|
||||||
help_text="Present file as attachment"
|
help_text="Download file as attachment"
|
||||||
)
|
)
|
||||||
|
|
||||||
objects = RestrictedQuerySet.as_manager()
|
objects = RestrictedQuerySet.as_manager()
|
||||||
|
Reference in New Issue
Block a user