33 lines
729 B
Python
33 lines
729 B
Python
from django.contrib import admin
|
|
|
|
from .models import Member, Flag
|
|
|
|
|
|
class ReadOnlyAdmin(admin.ModelAdmin):
|
|
def has_add_permission(self, request, obj=None):
|
|
return False
|
|
|
|
def has_change_permission(self, request, obj=None):
|
|
return False
|
|
|
|
def has_delete_permission(self, request, obj=None):
|
|
return False
|
|
|
|
|
|
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]
|
|
list_display = ["name", "type"]
|
|
list_filter = ["type"]
|
|
search_fields = ["name"]
|