from django.contrib import admin
from import_export.admin import ImportExportModelAdmin

from .models import PartCategory, Part
from .models import SupplierPart
from .models import BomItem


class PartAdmin(ImportExportModelAdmin):

    list_display = ('name', 'IPN', 'description', 'total_stock', 'category')


class PartCategoryAdmin(admin.ModelAdmin):

    list_display = ('name', 'pathstring', 'description')


class BomItemAdmin(ImportExportModelAdmin):
    list_display = ('part', 'sub_part', 'quantity')


class SupplierPartAdmin(ImportExportModelAdmin):
    list_display = ('part', 'supplier', 'SKU')


"""
class ParameterTemplateAdmin(admin.ModelAdmin):
    list_display = ('name', 'units', 'format')


class ParameterAdmin(admin.ModelAdmin):
    list_display = ('part', 'template', 'value')
"""

admin.site.register(Part, PartAdmin)
admin.site.register(PartCategory, PartCategoryAdmin)
admin.site.register(BomItem, BomItemAdmin)
admin.site.register(SupplierPart, SupplierPartAdmin)

@@ -117,24 +117,59 @@
 egory, Part%0A
+from .models import PartAttachment%0A
 from .models
@@ -218,17 +218,16 @@
 omItem%0A%0A
-%0A
 class Pa
@@ -438,24 +438,114 @@
 ription')%0A%0A%0A
+class PartAttachmentAdmin(admin.ModelAdmin):%0A%0A    list_display = ('part', 'attachment')%0A%0A%0A
 class BomIte
@@ -1009,24 +1009,81 @@
 egoryAdmin)%0A
+admin.site.register(PartAttachment, PartAttachmentAdmin)%0A
 admin.site.r

Add part attachments to the admin interface