##// END OF EJS Templates
Don't store threads list of a tag, cause this data can be got from thread's tags relations
Don't store threads list of a tag, cause this data can be got from thread's tags relations

File last commit:

r906:0d5b83db default
r909:ffe54c08 default
Show More
admin.py
42 lines | 1.1 KiB | text/x-python | PythonLexer
from django.contrib import admin
from boards.models import Post, Tag, Ban, Thread
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'text')
list_filter = ('pub_time', 'thread_new')
search_fields = ('id', 'title', 'text')
exclude = ('referenced_posts', 'refmap')
readonly_fields = ('poster_ip', 'thread_new')
@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
list_display = ('name',)
search_fields = ('name',)
@admin.register(Thread)
class ThreadAdmin(admin.ModelAdmin):
def title(self, obj):
return obj.get_opening_post().get_title()
def reply_count(self, obj):
return obj.get_reply_count()
def ip(self, obj):
return obj.get_opening_post().poster_ip
list_display = ('id', 'title', 'reply_count', 'archived', 'ip')
list_filter = ('bump_time', 'archived', 'bumpable')
search_fields = ('id', 'title')
@admin.register(Ban)
class BanAdmin(admin.ModelAdmin):
list_display = ('ip', 'can_read')
list_filter = ('can_read',)
search_fields = ('ip',)