2021-03-23 17:08:00 -04:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2022-02-11 13:48:47 -05:00
|
|
|
from .models import (
|
|
|
|
CmsRedRiverVeteransScholarship,
|
|
|
|
CertificationDefinition,
|
|
|
|
Certification,
|
|
|
|
CertificationVersion,
|
|
|
|
InstructorOrVendor,
|
|
|
|
SpecialProgram,
|
|
|
|
Waiver,
|
|
|
|
)
|
2021-03-23 17:08:00 -04:00
|
|
|
|
|
|
|
|
2022-02-04 16:30:52 -05:00
|
|
|
class CertificationVersionInline(admin.TabularInline):
|
|
|
|
model = CertificationVersion
|
|
|
|
extra = 1
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(CertificationVersion)
|
|
|
|
class CertificationVersionAdmin(admin.ModelAdmin):
|
2022-02-11 13:48:47 -05:00
|
|
|
search_fields = ["definition__certification_name", "version"]
|
|
|
|
list_display = ["definition", "version"]
|
|
|
|
list_filter = ["definition__department", "definition__certification_name"]
|
2022-02-04 16:30:52 -05:00
|
|
|
|
|
|
|
|
2022-02-03 13:45:58 -05:00
|
|
|
@admin.register(CertificationDefinition)
|
2021-03-23 17:08:00 -04:00
|
|
|
class CertificationDefinitionAdmin(admin.ModelAdmin):
|
2022-02-11 13:48:47 -05:00
|
|
|
search_fields = ["certification_name"]
|
|
|
|
list_display = ["certification_name", "department"]
|
|
|
|
list_filter = ["department"]
|
2022-02-04 16:30:52 -05:00
|
|
|
inlines = [CertificationVersionInline]
|
2021-03-23 17:08:00 -04:00
|
|
|
|
|
|
|
|
2022-02-03 13:45:58 -05:00
|
|
|
@admin.register(Certification)
|
2021-03-23 17:08:00 -04:00
|
|
|
class CertificationAdmin(admin.ModelAdmin):
|
2022-02-11 13:48:47 -05:00
|
|
|
search_fields = [
|
|
|
|
"name",
|
|
|
|
"certification__certification_name",
|
|
|
|
"certification__department",
|
|
|
|
]
|
|
|
|
autocomplete_fields = ["member"]
|
|
|
|
exclude = ["shop_lead_notified"]
|
2022-02-05 00:28:58 -05:00
|
|
|
|
2022-02-11 13:48:47 -05:00
|
|
|
@admin.display(
|
|
|
|
description="Certification Name",
|
|
|
|
ordering="certification_version__definition__certification_name",
|
|
|
|
)
|
2022-02-05 00:28:58 -05:00
|
|
|
def certification_name(self, obj):
|
|
|
|
return obj.certification_version.definition.certification_name
|
|
|
|
|
2022-02-11 13:48:47 -05:00
|
|
|
@admin.display(
|
|
|
|
description="Certification Version", ordering="certification_version__version"
|
|
|
|
)
|
2022-02-05 00:28:58 -05:00
|
|
|
def certification_version_version(self, obj):
|
|
|
|
return obj.certification_version.version
|
|
|
|
|
2022-02-11 13:48:47 -05:00
|
|
|
@admin.display(
|
|
|
|
description="Department",
|
|
|
|
ordering="certification_version__definition__department",
|
|
|
|
)
|
2022-02-05 00:28:58 -05:00
|
|
|
def certification_department(self, obj):
|
|
|
|
return obj.certification_version.definition.department
|
|
|
|
|
|
|
|
list_display = [
|
2022-02-11 13:48:47 -05:00
|
|
|
"certification_name",
|
|
|
|
"name",
|
|
|
|
"certification_version_version",
|
|
|
|
"certification_department",
|
|
|
|
"date",
|
|
|
|
"shop_lead_notified",
|
|
|
|
"certified_by",
|
2022-02-05 00:28:58 -05:00
|
|
|
]
|
|
|
|
list_display_links = [
|
2022-02-11 13:48:47 -05:00
|
|
|
"certification_name",
|
|
|
|
"name",
|
2022-02-05 00:28:58 -05:00
|
|
|
]
|
|
|
|
list_filter = [
|
2022-02-11 13:48:47 -05:00
|
|
|
"certification_version__definition__department",
|
|
|
|
("shop_lead_notified", admin.EmptyFieldListFilter),
|
2022-02-05 00:28:58 -05:00
|
|
|
]
|
2021-03-23 17:08:00 -04:00
|
|
|
|
|
|
|
|
2022-02-03 13:45:58 -05:00
|
|
|
@admin.register(InstructorOrVendor)
|
2021-03-23 17:08:00 -04:00
|
|
|
class InstructorOrVendorAdmin(admin.ModelAdmin):
|
2022-02-11 13:48:47 -05:00
|
|
|
search_fields = ["name"]
|
2021-03-23 17:08:00 -04:00
|
|
|
|
|
|
|
|
2022-02-03 13:45:58 -05:00
|
|
|
@admin.register(SpecialProgram)
|
2021-03-23 17:08:00 -04:00
|
|
|
class SpecialProgramAdmin(admin.ModelAdmin):
|
2022-02-11 13:48:47 -05:00
|
|
|
search_fields = ["program_name"]
|
2021-03-23 17:08:00 -04:00
|
|
|
|
|
|
|
|
2022-02-03 13:45:58 -05:00
|
|
|
@admin.register(Waiver)
|
2021-03-23 17:08:00 -04:00
|
|
|
class WaiverAdmin(admin.ModelAdmin):
|
2022-02-11 13:48:47 -05:00
|
|
|
search_fields = ["name"]
|
2021-03-23 17:08:00 -04:00
|
|
|
|
|
|
|
|
|
|
|
admin.site.register(CmsRedRiverVeteransScholarship)
|