Inline Tool/Task subscriptions in the admin interface

This commit is contained in:
Adam Goldsmith 2021-05-14 22:20:49 -04:00
parent 6d1ef6ab22
commit dc4bfcca29

View File

@ -3,14 +3,24 @@ from markdownx.admin import MarkdownxModelAdmin
from .models import Tool, Task, Event, GroupTaskSubscription, GroupToolSubscription
admin.site.register(Tool)
class GroupTaskSubscriptionInline(admin.TabularInline):
model = GroupTaskSubscription
class GroupToolSubscriptionInline(admin.TabularInline):
model = GroupToolSubscription
@admin.register(Task)
class TaskAdmin(MarkdownxModelAdmin):
inlines = [GroupTaskSubscriptionInline]
prepopulated_fields = {"slug": ("name",)}
admin.site.register(GroupTaskSubscription)
admin.site.register(GroupToolSubscription)
@admin.register(Tool)
class ToolAdmin(admin.ModelAdmin):
inlines = [GroupToolSubscriptionInline]
admin.site.register(Event)