##// END OF EJS Templates
Cosmetic changes to the admin models
neko259 -
r883:e01941af default
parent child Browse files
Show More
@@ -1,36 +1,38 b''
1 from django.contrib import admin
1 from django.contrib import admin
2 from boards.models import Post, Tag, Ban, Thread
2 from boards.models import Post, Tag, Ban, Thread
3
3
4
4
5 class PostAdmin(admin.ModelAdmin):
5 class PostAdmin(admin.ModelAdmin):
6
6
7 list_display = ('id', 'title', 'text')
7 list_display = ('id', 'title', 'text')
8 list_filter = ('pub_time', 'thread_new')
8 list_filter = ('pub_time', 'thread_new')
9 search_fields = ('id', 'title', 'text')
9 search_fields = ('id', 'title', 'text')
10
10
11
11
12 class TagAdmin(admin.ModelAdmin):
12 class TagAdmin(admin.ModelAdmin):
13
13
14 list_display = ('name',)
14 list_display = ('name',)
15
15
16
16 class ThreadAdmin(admin.ModelAdmin):
17 class ThreadAdmin(admin.ModelAdmin):
17
18
18 def title(self, obj):
19 def title(self, obj):
19 return obj.get_opening_post().title
20 return obj.get_opening_post().get_title()
20
21
21 def reply_count(self, obj):
22 def reply_count(self, obj):
22 return obj.get_reply_count()
23 return obj.get_reply_count()
23
24
24 list_display = ('id', 'title', 'reply_count', 'archived')
25 list_display = ('id', 'title', 'reply_count', 'archived')
25 list_filter = ('bump_time', 'archived')
26 list_filter = ('bump_time', 'archived')
26 search_fields = ('id', 'title')
27 search_fields = ('id', 'title')
27
28
29
28 class BanAdmin(admin.ModelAdmin):
30 class BanAdmin(admin.ModelAdmin):
29 list_display = ('ip', 'can_read')
31 list_display = ('ip', 'can_read')
30 list_filter = ('can_read',)
32 list_filter = ('can_read',)
31 search_fields = ('ip',)
33 search_fields = ('ip',)
32
34
33 admin.site.register(Post, PostAdmin)
35 admin.site.register(Post, PostAdmin)
34 admin.site.register(Tag, TagAdmin)
36 admin.site.register(Tag, TagAdmin)
35 admin.site.register(Ban, BanAdmin)
37 admin.site.register(Ban, BanAdmin)
36 admin.site.register(Thread, ThreadAdmin)
38 admin.site.register(Thread, ThreadAdmin)
General Comments 0
You need to be logged in to leave comments. Login now