33 lines
767 B
Python
33 lines
767 B
Python
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
|
|
|
|
|
|
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",)}
|