Add IP bans

Users can be banned by IP address now, either by singular IP or in an IP
range. If they are banned and attempt to post, they will be met with a
"you are banned until X date" screen.

There are a few loose threads with this, and IP bans may be obsolete if
I decide to go the accounts-required-for-posting route. But I think this
is a good start for 4chan style posting.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-20 15:26:35 -07:00
parent b4df8b9756
commit 28ccd7d73b
7 changed files with 190 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
from django.contrib import admin
from django.utils.safestring import mark_safe
from board.models import Board, Post, ReportReason, ReportRecord
from board.models import Ban, Board, Post, RangeBan, ReportReason, ReportRecord
@admin.register(Board)
@@ -45,3 +45,13 @@ class ReportRecordAdmin(admin.ModelAdmin):
html += f"<p>{obj.post.text}</p>"
html += "</div>"
return mark_safe(html)
@admin.register(RangeBan)
class RangeBanAdmin(admin.ModelAdmin):
pass
@admin.register(Ban)
class BanAdmin(admin.ModelAdmin):
pass