__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from .models import Forum, Meeting, Post, Motion
[docs]class ForumAdmin(GuardedModelAdmin):
prepopulated_fields = {"slug": ("name",)}
search_fields = ["name", "description"]
autocomplete_fields = [
"moderators",
]
admin.site.register(Forum, ForumAdmin)
[docs]class MeetingAdmin(GuardedModelAdmin):
prepopulated_fields = {"slug": ("name",)}
search_fields = ["name", "description", "preamble"]
autocomplete_fields = [
"moderators",
]
admin.site.register(Meeting, MeetingAdmin)
[docs]class PostAdmin(admin.ModelAdmin):
search_fields = ["posted_by", "subject", "text"]
autocomplete_fields = [
"posted_by",
"vetted_by",
]
admin.site.register(Post, PostAdmin)
[docs]class MotionAdmin(admin.ModelAdmin):
search_fields = ["posted_by", "subject", "text"]
autocomplete_fields = [
"posted_by",
"vetted_by",
"post",
"eligible_for_voting",
"in_agreement",
"in_doubt",
"in_disagreement",
"in_abstain",
]
admin.site.register(Motion, MotionAdmin)