-
Notifications
You must be signed in to change notification settings - Fork 9
/
admin.py
26 lines (22 loc) · 873 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext as _
from vkontakte_api.admin import VkontakteModelAdmin
from models import Post, Comment
class CommentInline(admin.TabularInline):
model = Comment
extra = 0
can_delete = False
fields = ('author','text','date','likes')
readonly_fields = fields
class PostAdmin(VkontakteModelAdmin):
list_display = ('wall_owner','text','author','vk_link','date','comments','likes','reposts')
list_display_links = ('text',)
# list_filter = ('wall_owner',)
search_fields = ('text','copy_text')
exclude = ('like_users','repost_users',)
inlines = [CommentInline]
class CommentAdmin(VkontakteModelAdmin):
list_display = ('author','post','vk_link','date','likes')
admin.site.register(Post, PostAdmin)
admin.site.register(Comment, CommentAdmin)