Show More
@@ -26,7 +26,7 b' class PostAdmin(admin.ModelAdmin):' | |||
|
26 | 26 | bans += 1 |
|
27 | 27 | self.message_user(request, _('{} posters were banned').format(bans)) |
|
28 | 28 | |
|
29 |
def ban_ |
|
|
29 | def ban_latter_with_delete(self, request, queryset): | |
|
30 | 30 | bans = 0 |
|
31 | 31 | hidden = 0 |
|
32 | 32 | for post in queryset: |
@@ -36,8 +36,9 b' class PostAdmin(admin.ModelAdmin):' | |||
|
36 | 36 | bans += 1 |
|
37 | 37 | posts = Post.objects.filter(poster_ip=poster_ip, id__gte=post.id) |
|
38 | 38 | hidden += posts.count() |
|
39 |
posts. |
|
|
40 |
self.message_user(request, _('{} posters were banned, {} messages were |
|
|
39 | posts.delete() | |
|
40 | self.message_user(request, _('{} posters were banned, {} messages were removed.').format(bans, hidden)) | |
|
41 | ban_latter_with_delete.short_description = 'Ban user and delete posts starting from this one and later' | |
|
41 | 42 | |
|
42 | 43 | def linked_images(self, obj: Post): |
|
43 | 44 | images = obj.attachments.filter(mimetype__in=FILE_TYPES_IMAGE) |
@@ -66,7 +67,7 b' class PostAdmin(admin.ModelAdmin):' | |||
|
66 | 67 | return obj is not None and obj.global_id is not None and\ |
|
67 | 68 | not obj.global_id.is_local() |
|
68 | 69 | |
|
69 |
actions = ['ban_poster', 'ban_ |
|
|
70 | actions = ['ban_poster', 'ban_latter_with_delete'] | |
|
70 | 71 | |
|
71 | 72 | |
|
72 | 73 | @admin.register(Tag) |
General Comments 0
You need to be logged in to leave comments.
Login now