from django.contrib import admin from .models import (CmsRedRiverVeteransScholarship, CertificationDefinition, Certification, InstructorOrVendor, SpecialProgram, Waiver, Member) class CertificationDefinitionAdmin(admin.ModelAdmin): search_fields = ['certification_name', 'department'] class CertificationAdmin(admin.ModelAdmin): search_fields = ['name', 'certification__certification_name', 'certification__department'] class InstructorOrVendorAdmin(admin.ModelAdmin): search_fields = ['name'] class SpecialProgramAdmin(admin.ModelAdmin): search_fields = ['program_name'] class WaiverAdmin(admin.ModelAdmin): search_fields = ['name'] class MemberAdmin(admin.ModelAdmin): readonly_fields = [field.name for field in Member._meta.get_fields() if field.concrete] def has_add_permission(self, request, obj=None): return False def has_delete_permission(self, request, obj=None): return False admin.site.register(CmsRedRiverVeteransScholarship) admin.site.register(CertificationDefinition, CertificationDefinitionAdmin) admin.site.register(Certification, CertificationAdmin) admin.site.register(InstructorOrVendor, InstructorOrVendorAdmin) admin.site.register(SpecialProgram, SpecialProgramAdmin) admin.site.register(Waiver, WaiverAdmin) admin.site.register(Member, MemberAdmin)