##// END OF EJS Templates
Actually delete the opening post when deleting the thread
Actually delete the opening post when deleting the thread

File last commit:

r883:e01941af default
r884:e3087995 default
Show More
admin.py
38 lines | 930 B | text/x-python | PythonLexer
from django.contrib import admin
from boards.models import Post, Tag, Ban, Thread
class PostAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'text')
list_filter = ('pub_time', 'thread_new')
search_fields = ('id', 'title', 'text')
class TagAdmin(admin.ModelAdmin):
list_display = ('name',)
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()
list_display = ('id', 'title', 'reply_count', 'archived')
list_filter = ('bump_time', 'archived')
search_fields = ('id', 'title')
class BanAdmin(admin.ModelAdmin):
list_display = ('ip', 'can_read')
list_filter = ('can_read',)
search_fields = ('ip',)
admin.site.register(Post, PostAdmin)
admin.site.register(Tag, TagAdmin)
admin.site.register(Ban, BanAdmin)
admin.site.register(Thread, ThreadAdmin)