Show More
@@ -8,13 +8,14 b' from boards.models import Post, Tag, Ban' | |||||
8 | @admin.register(Post) |
|
8 | @admin.register(Post) | |
9 | class PostAdmin(admin.ModelAdmin): |
|
9 | class PostAdmin(admin.ModelAdmin): | |
10 |
|
10 | |||
11 |
list_display = ('id', 'title', 'text', 'poster_ip', 'linked_images', |
|
11 | list_display = ('id', 'title', 'text', 'poster_ip', 'linked_images', | |
|
12 | 'foreign') | |||
12 | list_filter = ('pub_time',) |
|
13 | list_filter = ('pub_time',) | |
13 | search_fields = ('id', 'title', 'text', 'poster_ip') |
|
14 | search_fields = ('id', 'title', 'text', 'poster_ip') | |
14 | exclude = ('referenced_posts', 'refmap', 'images', 'global_id') |
|
15 | exclude = ('referenced_posts', 'refmap', 'images', 'global_id') | |
15 | readonly_fields = ('poster_ip', 'threads', 'thread', 'linked_images', |
|
16 | readonly_fields = ('poster_ip', 'threads', 'thread', 'linked_images', | |
16 | 'attachments', 'uid', 'url', 'pub_time', 'opening', 'linked_global_id', |
|
17 | 'attachments', 'uid', 'url', 'pub_time', 'opening', 'linked_global_id', | |
17 | 'version') |
|
18 | 'version', 'foreign') | |
18 |
|
19 | |||
19 | def ban_poster(self, request, queryset): |
|
20 | def ban_poster(self, request, queryset): | |
20 | bans = 0 |
|
21 | bans = 0 | |
@@ -61,6 +62,10 b' class PostAdmin(admin.ModelAdmin):' | |||||
61 | obj.save() |
|
62 | obj.save() | |
62 | obj.clear_cache() |
|
63 | obj.clear_cache() | |
63 |
|
64 | |||
|
65 | def foreign(self, obj: Post): | |||
|
66 | return obj is not None and obj.global_id is not None and\ | |||
|
67 | not obj.global_id.is_local() | |||
|
68 | ||||
64 | actions = ['ban_poster', 'ban_with_hiding'] |
|
69 | actions = ['ban_poster', 'ban_with_hiding'] | |
65 |
|
70 | |||
66 |
|
71 |
General Comments 0
You need to be logged in to leave comments.
Login now