|
|
from django.contrib import admin
|
|
|
from boards.models import Post, Tag, User, 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', 'linked')
|
|
|
list_filter = ('linked',)
|
|
|
|
|
|
|
|
|
class UserAdmin(admin.ModelAdmin):
|
|
|
|
|
|
list_display = ('user_id', 'rank')
|
|
|
search_fields = ('user_id',)
|
|
|
|
|
|
|
|
|
class ThreadAdmin(admin.ModelAdmin):
|
|
|
|
|
|
def title(self, obj):
|
|
|
return obj.get_opening_post().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')
|
|
|
|
|
|
admin.site.register(Post, PostAdmin)
|
|
|
admin.site.register(Tag, TagAdmin)
|
|
|
admin.site.register(User, UserAdmin)
|
|
|
admin.site.register(Ban)
|
|
|
admin.site.register(Thread, ThreadAdmin)
|
|
|
|