cmsmanage/tasks/admin.py

33 lines
767 B
Python
Raw Permalink Normal View History

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