# HG changeset patch # User neko259 # Date 2016-05-13 21:21:44 # Node ID 39bc50e6326e9116da3ba80ed936a23b22585811 # Parent 9e8b09257afde2317ff48fb656bfb5ff3c9bfbff In admin site, show if the post is foreign diff --git a/boards/admin.py b/boards/admin.py --- a/boards/admin.py +++ b/boards/admin.py @@ -8,13 +8,14 @@ from boards.models import Post, Tag, Ban @admin.register(Post) class PostAdmin(admin.ModelAdmin): - list_display = ('id', 'title', 'text', 'poster_ip', 'linked_images', 'linked_global_id') + list_display = ('id', 'title', 'text', 'poster_ip', 'linked_images', + 'foreign') list_filter = ('pub_time',) search_fields = ('id', 'title', 'text', 'poster_ip') exclude = ('referenced_posts', 'refmap', 'images', 'global_id') readonly_fields = ('poster_ip', 'threads', 'thread', 'linked_images', 'attachments', 'uid', 'url', 'pub_time', 'opening', 'linked_global_id', - 'version') + 'version', 'foreign') def ban_poster(self, request, queryset): bans = 0 @@ -61,6 +62,10 @@ class PostAdmin(admin.ModelAdmin): obj.save() obj.clear_cache() + def foreign(self, obj: Post): + return obj is not None and obj.global_id is not None and\ + not obj.global_id.is_local() + actions = ['ban_poster', 'ban_with_hiding']