##// END OF EJS Templates
Use dict instead of context instance in post view API
Use dict instead of context instance in post view API

File last commit:

r1015:c84f21f3 merge decentral
r1075:d66b9778 default
Show More
admin.py
59 lines | 1.6 KiB | text/x-python | PythonLexer
neko259
Initial commit. One test doesn't work, missing posting form.
r0 from django.contrib import admin
neko259
Removed user and settings mode. Added settings manager to manage settings and keep them in the session (or any other backend like cookie in the future
r728 from boards.models import Post, Tag, Ban, Thread
neko259
Added admin action to ban user that posted given messages
r968 from django.utils.translation import ugettext_lazy as _
neko259
Initial commit. One test doesn't work, missing posting form.
r0
neko259
Moved some settings to boards.settings
r333
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 @admin.register(Post)
neko259
Added a better admin interface.
r305 class PostAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'text')
neko259
Don't list all threads to filter posts by
r969 list_filter = ('pub_time',)
neko259
Added a better admin interface.
r305 search_fields = ('id', 'title', 'text')
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 exclude = ('referenced_posts', 'refmap')
neko259
Made thread and images list read-only in admin (BB-55)
r989 readonly_fields = ('poster_ip', 'threads', 'thread', 'images')
neko259
Added a better admin interface.
r305
neko259
Added admin action to ban user that posted given messages
r968 def ban_poster(self, request, queryset):
bans = 0
for post in queryset:
poster_ip = post.poster_ip
ban, created = Ban.objects.get_or_create(ip=poster_ip)
if created:
bans += 1
self.message_user(request, _('{} posters were banned').format(bans))
actions = ['ban_poster']
neko259
Moved some settings to boards.settings
r333
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 @admin.register(Tag)
neko259
Added a better admin interface.
r305 class TagAdmin(admin.ModelAdmin):
neko259
Small admin changes
r910 def thread_count(self, obj: Tag) -> int:
return obj.get_thread_count()
list_display = ('name', 'thread_count')
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 search_fields = ('name',)
neko259
Added a better admin interface.
r305
neko259
Cosmetic changes to the admin models
r883
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 @admin.register(Thread)
neko259
Added thread admin interface
r604 class ThreadAdmin(admin.ModelAdmin):
neko259
Small admin changes
r910 def title(self, obj: Thread) -> str:
neko259
Cosmetic changes to the admin models
r883 return obj.get_opening_post().get_title()
neko259
Added thread admin interface
r604
neko259
Small admin changes
r910 def reply_count(self, obj: Thread) -> int:
neko259
Added thread admin interface
r604 return obj.get_reply_count()
neko259
Small admin changes
r910 def ip(self, obj: Thread):
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 return obj.get_opening_post().poster_ip
list_display = ('id', 'title', 'reply_count', 'archived', 'ip')
list_filter = ('bump_time', 'archived', 'bumpable')
neko259
Added thread admin interface
r604 search_fields = ('id', 'title')
neko259
Better interface for the thread admin tags list
r921 filter_horizontal = ('tags',)
neko259
Added thread admin interface
r604
neko259
Cosmetic changes to the admin models
r883
neko259
Cleaned up admin site. Update thread's tags list when it is saved
r906 @admin.register(Ban)
neko259
Updated ban admin to search by ip
r804 class BanAdmin(admin.ModelAdmin):
list_display = ('ip', 'can_read')
list_filter = ('can_read',)
neko259
Better interface for the thread admin tags list
r921 search_fields = ('ip',)