Add admin capcodes

Sometimes, it is necessary for an admin or other moderator to reveal
themselves. Capcodes allow them to do so by appending a special colored
portion at the end of their name on a post.

This adds object-level permissions, so if you have a moderator who
shouldn't be able to use the "admin" capcode, you can give them
permission only to the "moderator" capcode.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-28 21:37:45 -07:00
parent 29dff20db9
commit ab749359fa
9 changed files with 110 additions and 46 deletions

View File

@@ -1,15 +1,10 @@
from django.contrib import admin
from django.urls import reverse
from django.utils.safestring import mark_safe
from board.models import (
Ban,
BanTemplate,
Board,
Post,
RangeBan,
ReportReason,
ReportRecord,
)
from guardian.admin import GuardedModelAdmin
from board.models import *
#
# Admin sites
@@ -82,3 +77,8 @@ class BanAdmin(admin.ModelAdmin):
@admin.register(BanTemplate)
class BanTemplateAdmin(admin.ModelAdmin):
ordering = ("board__url", "name")
@admin.register(Capcode)
class CapcodeAdmin(GuardedModelAdmin):
pass