61 lines
1.3 KiB
Python
Executable File
61 lines
1.3 KiB
Python
Executable File
from django.contrib import admin
|
|
from nested_admin import nested
|
|
|
|
|
|
from outbo.apps.core.admin import (
|
|
NestedTabularSingleItemInline,
|
|
NestedStackedSingleItemInline,
|
|
)
|
|
from outbo.apps.products.models import (
|
|
ProductStage,
|
|
PackagingType,
|
|
Product,
|
|
DraftFile,
|
|
FirstFinalFile,
|
|
PrintingFilesFile,
|
|
BriefConfig,
|
|
Brief,
|
|
Photo,
|
|
Blanking,
|
|
)
|
|
|
|
admin.site.register(PackagingType)
|
|
admin.site.register(ProductStage)
|
|
|
|
|
|
class PhotoInline(nested.NestedStackedInline):
|
|
model = Photo
|
|
readonly_fields = ["brief"]
|
|
extra = 0
|
|
|
|
|
|
class BlankingInline(nested.NestedStackedInline):
|
|
model = Blanking
|
|
readonly_fields = ["brief"]
|
|
extra = 0
|
|
|
|
|
|
class BriefConfigInline(NestedTabularSingleItemInline):
|
|
model = BriefConfig
|
|
readonly_fields = ["brief"]
|
|
can_delete = False
|
|
|
|
|
|
class BriefInline(NestedStackedSingleItemInline):
|
|
model = Brief
|
|
readonly_fields = ["product"]
|
|
can_delete = False
|
|
inlines = [PhotoInline, BlankingInline, BriefConfigInline]
|
|
|
|
|
|
@admin.register(Product)
|
|
class ProductAdmin(nested.NestedModelAdmin):
|
|
readonly_fields = ["stage"]
|
|
search_fields = ["project__name"]
|
|
inlines = [BriefInline]
|
|
|
|
|
|
admin.site.register(DraftFile)
|
|
admin.site.register(FirstFinalFile)
|
|
admin.site.register(PrintingFilesFile)
|