2022-02-03 13:45:58 -05:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2022-02-10 16:51:32 -05:00
|
|
|
from .models import Member, Flag
|
2022-02-03 13:45:58 -05:00
|
|
|
|
|
|
|
|
2022-02-10 16:51:32 -05:00
|
|
|
class ReadOnlyAdmin(admin.ModelAdmin):
|
2022-02-03 13:45:58 -05:00
|
|
|
def has_add_permission(self, request, obj=None):
|
|
|
|
return False
|
|
|
|
|
2022-02-10 16:51:32 -05:00
|
|
|
def has_change_permission(self, request, obj=None):
|
|
|
|
return False
|
|
|
|
|
2022-02-03 13:45:58 -05:00
|
|
|
def has_delete_permission(self, request, obj=None):
|
|
|
|
return False
|
2022-02-10 16:51:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
class MemberFlagInline(admin.TabularInline):
|
|
|
|
model = Member.flags.through
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Member)
|
|
|
|
class MemberAdmin(ReadOnlyAdmin):
|
|
|
|
search_fields = ['account_name']
|
|
|
|
inlines = [MemberFlagInline]
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Flag)
|
|
|
|
class FlagAdmin(ReadOnlyAdmin):
|
|
|
|
inlines = [MemberFlagInline]
|