Add control code preview generation

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-09-01 14:35:04 -04:00
parent 2819f9445b
commit f9ba08ee59
19 changed files with 1154 additions and 6 deletions

View File

@@ -0,0 +1,23 @@
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import ControlSheet, ControlSheetCode
class ControlSheetCodeInline(admin.StackedInline):
allow_add = True
classes = ('collapse-open',)
extra = 1
model = ControlSheetCode
@admin.register(ControlSheet)
class ControlSheetAdmin(admin.ModelAdmin):
inlines = (ControlSheetCodeInline,)
list_display = ('label', 'get_codes_count')
def get_codes_count(self, instance):
return instance.codes.count()
get_codes_count.short_description = _('Codes')