diff --git a/bookwyrm/forms/admin.py b/bookwyrm/forms/admin.py index 6b2984b3..4141327d 100644 --- a/bookwyrm/forms/admin.py +++ b/bookwyrm/forms/admin.py @@ -5,6 +5,7 @@ from django import forms from django.forms import widgets from django.utils import timezone from django.utils.translation import gettext_lazy as _ +from django_celery_beat.models import IntervalSchedule from bookwyrm import models from .custom_form import CustomForm @@ -127,3 +128,14 @@ class AutoModRuleForm(CustomForm): class Meta: model = models.AutoMod fields = ["string_match", "flag_users", "flag_statuses", "created_by"] + + +class IntervalScheduleForm(CustomForm): + class Meta: + model = IntervalSchedule + fields = ["every", "period"] + + widgets = { + "every": forms.NumberInput(attrs={"aria-describedby": "desc_every"}), + "period": forms.Select(attrs={"aria-describedby": "desc_period"}), + } diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 5ab3c7a1..ec30bd67 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -90,6 +90,7 @@ INSTALLED_APPS = [ "sass_processor", "bookwyrm", "celery", + "django_celery_beat", "imagekit", "storages", ] diff --git a/bookwyrm/templates/settings/automod/rules.html b/bookwyrm/templates/settings/automod/rules.html index 8205b3d7..ef0a49be 100644 --- a/bookwyrm/templates/settings/automod/rules.html +++ b/bookwyrm/templates/settings/automod/rules.html @@ -1,5 +1,6 @@ {% extends 'settings/layout.html' %} {% load i18n %} +{% load humanize %} {% load utilities %} {% block title %} @@ -16,12 +17,81 @@
{% trans "Auto-moderation rules will create reports for any local user or status with fields matching the provided string." %} {% trans "Users or statuses that have already been reported (regardless of whether the report was resolved) will not be flagged." %} - {% trans "At this time, reports are not being generated automatically, and you must manually trigger a scan." %}
-