Add report record admin and template search
When creating a ban, you can type in to do a search, this is useful for quickly banning users. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from typing import Any, Dict
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
from django.db.models import Q
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.views.generic.base import TemplateView
|
||||
@@ -8,7 +9,7 @@ from django.views.generic.edit import CreateView
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils import timezone
|
||||
from board.forms import BanForm, PostForm, ReplyForm, ReportForm
|
||||
from board.models import Ban, Board, Post, Report
|
||||
from board.models import Ban, BanTemplate, Board, Post, Report
|
||||
from board.utils import get_client_ip, get_ip_bans
|
||||
|
||||
__all__ = (
|
||||
@@ -186,6 +187,9 @@ class BanCreateView(PermissionRequiredMixin, CreateView):
|
||||
context["current_bans"] = [
|
||||
ban for ban in bans if ban.expires is None or ban.expires > now
|
||||
]
|
||||
context["templates"] = BanTemplate.objects.filter(
|
||||
Q(board=self.board) | Q(board=None)
|
||||
)
|
||||
|
||||
return context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user