diff --git a/chat/admin.py b/chat/admin.py index 3ce3d6b..47ac233 100644 --- a/chat/admin.py +++ b/chat/admin.py @@ -2,10 +2,22 @@ from .models import Conversation, Message, Setting -admin.site.register(Conversation) -admin.site.register(Message) -class SettingAdmin(admin.ModelAdmin): - list_display = ('name', 'value') +@admin.register(Conversation) +class ConversationAdmin(admin.ModelAdmin): + list_display = ('id', 'user', 'topic', 'created_at') + + +@admin.register(Message) +class MessageAdmin(admin.ModelAdmin): + list_display = ('id', 'get_conversation_topic', 'message', 'is_bot', 'created_at') + + def get_conversation_topic(self, obj): + return obj.conversation.topic -admin.site.register(Setting, SettingAdmin) \ No newline at end of file + get_conversation_topic.short_description = 'Conversation Topic' + + +@admin.register(Setting) +class SettingAdmin(admin.ModelAdmin): + list_display = ('name', 'value') \ No newline at end of file