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']