cmsmanage/tasks/admin.py

32 lines
766 B
Python

from django.contrib import admin
from markdownx.admin import MarkdownxModelAdmin
from .models import Tool, Task, Event, GroupTaskSubscription, GroupToolSubscription
class GroupTaskSubscriptionInline(admin.TabularInline):
model = GroupTaskSubscription
extra = 0
class GroupToolSubscriptionInline(admin.TabularInline):
model = GroupToolSubscription
extra = 0
class EventInline(admin.TabularInline):
model = Event
extra = 0
@admin.register(Task)
class TaskAdmin(MarkdownxModelAdmin):
inlines = [GroupTaskSubscriptionInline, EventInline]
prepopulated_fields = {"slug": ("name",)}
@admin.register(Tool)
class ToolAdmin(admin.ModelAdmin):
inlines = [GroupToolSubscriptionInline]
prepopulated_fields = {"slug": ("name",)}