Просмотр исходного кода

Closes #5830: Add as_attachment field to API serializers and admin view.

Martin Rødvand 4 лет назад
Родитель
Сommit
878154c305
3 измененных файлов с 4 добавлено и 4 удалено
  1. 2 2
      netbox/extras/admin.py
  2. 1 1
      netbox/extras/api/serializers.py
  3. 1 1
      netbox/extras/models/models.py

+ 2 - 2
netbox/extras/admin.py

@@ -193,7 +193,7 @@ class ExportTemplateForm(forms.ModelForm):
 class ExportTemplateAdmin(admin.ModelAdmin):
     fieldsets = (
         ('Export Template', {
-            'fields': ('content_type', 'name', 'description', 'mime_type', 'file_extension')
+            'fields': ('content_type', 'name', 'description', 'mime_type', 'file_extension', 'as_attachment')
         }),
         ('Content', {
             'fields': ('template_code',),
@@ -201,7 +201,7 @@ class ExportTemplateAdmin(admin.ModelAdmin):
         })
     )
     list_display = [
-        'name', 'content_type', 'description', 'mime_type', 'file_extension',
+        'name', 'content_type', 'description', 'mime_type', 'file_extension', 'as_attachment',
     ]
     list_filter = [
         'content_type',

+ 1 - 1
netbox/extras/api/serializers.py

@@ -116,7 +116,7 @@ class ExportTemplateSerializer(ValidatedModelSerializer):
         model = ExportTemplate
         fields = [
             'id', 'url', 'display', 'content_type', 'name', 'description', 'template_code', 'mime_type',
-            'file_extension',
+            'file_extension', 'as_attachment',
         ]
 
 

+ 1 - 1
netbox/extras/models/models.py

@@ -253,7 +253,7 @@ class ExportTemplate(BigIDModel):
     )
     as_attachment = models.BooleanField(
         default=True,
-        help_text="Present file as attachment"
+        help_text="Download file as attachment"
     )
 
     objects = RestrictedQuerySet.as_manager()