mirror of
https://github.com/Mistake35/Cedar-Django.git
synced 2026-07-18 00:21:14 +10:00
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.
This commit is contained in:
@@ -88,8 +88,13 @@ class ConversationAdmin(admin.ModelAdmin):
|
|||||||
class CommentsInline(admin.TabularInline):
|
class CommentsInline(admin.TabularInline):
|
||||||
model = models.Comment
|
model = models.Comment
|
||||||
extra = 0
|
extra = 0
|
||||||
fields = ('creator', 'body', 'is_rm')
|
fields = ('creator', 'body', 'is_rm', )
|
||||||
raw_id_fields = ('creator',)
|
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):
|
class PostAdmin(admin.ModelAdmin):
|
||||||
inlines = [CommentsInline]
|
inlines = [CommentsInline]
|
||||||
|
|||||||
Reference in New Issue
Block a user