From bcec15ab0764d26469667e8b3c8707ed32f2f93d Mon Sep 17 00:00:00 2001 From: some weird guy <120821766+Mistake35@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:04:31 -0700 Subject: [PATCH] I had two choices As cool as this new admin comment thing is, either I have to include all required fields in the inline otherwise it will throw an error when adding a new comment, or simply make it mostly read only and keep it simple. --- closedverse_main/admin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/closedverse_main/admin.py b/closedverse_main/admin.py index f8a130d..cbf6fdc 100644 --- a/closedverse_main/admin.py +++ b/closedverse_main/admin.py @@ -88,8 +88,13 @@ class ConversationAdmin(admin.ModelAdmin): class CommentsInline(admin.TabularInline): model = models.Comment extra = 0 - fields = ('creator', 'body', 'is_rm') - raw_id_fields = ('creator',) + fields = ('creator', 'body', 'is_rm', ) + readonly_fields = ('creator', ) + def has_add_permission(self, request, obj=None): + return False + def has_delete_permission(self, request, obj=None): + return False + class PostAdmin(admin.ModelAdmin): inlines = [CommentsInline]