From f3e6ed56b927794920fe957ddbe25145e3fda8bb Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 4 Mar 2025 10:26:25 -0800 Subject: [PATCH] Removes the unused Log model and LogFilterSet (#9294) --- src/documents/filters.py | 7 ----- src/documents/migrations/1064_delete_log.py | 15 ++++++++++ src/documents/models.py | 31 --------------------- 3 files changed, 15 insertions(+), 38 deletions(-) create mode 100644 src/documents/migrations/1064_delete_log.py diff --git a/src/documents/filters.py b/src/documents/filters.py index d3b0ad3ce..90161a1e6 100644 --- a/src/documents/filters.py +++ b/src/documents/filters.py @@ -36,7 +36,6 @@ from documents.models import CustomField from documents.models import CustomFieldInstance from documents.models import Document from documents.models import DocumentType -from documents.models import Log from documents.models import PaperlessTask from documents.models import ShareLink from documents.models import StoragePath @@ -761,12 +760,6 @@ class DocumentFilterSet(FilterSet): } -class LogFilterSet(FilterSet): - class Meta: - model = Log - fields = {"level": INT_KWARGS, "created": DATE_KWARGS, "group": ID_KWARGS} - - class ShareLinkFilterSet(FilterSet): class Meta: model = ShareLink diff --git a/src/documents/migrations/1064_delete_log.py b/src/documents/migrations/1064_delete_log.py new file mode 100644 index 000000000..ec0830a91 --- /dev/null +++ b/src/documents/migrations/1064_delete_log.py @@ -0,0 +1,15 @@ +# Generated by Django 5.1.6 on 2025-02-28 15:19 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("documents", "1063_paperlesstask_type_alter_paperlesstask_task_name_and_more"), + ] + + operations = [ + migrations.DeleteModel( + name="Log", + ), + ] diff --git a/src/documents/models.py b/src/documents/models.py index 42e473438..57ff96df1 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -1,5 +1,4 @@ import datetime -import logging import os import re from collections import OrderedDict @@ -379,36 +378,6 @@ class Document(SoftDeleteModel, ModelWithOwner): return timezone.localdate(self.created) -class Log(models.Model): - LEVELS = ( - (logging.DEBUG, _("debug")), - (logging.INFO, _("information")), - (logging.WARNING, _("warning")), - (logging.ERROR, _("error")), - (logging.CRITICAL, _("critical")), - ) - - group = models.UUIDField(_("group"), blank=True, null=True) - - message = models.TextField(_("message")) - - level = models.PositiveIntegerField( - _("level"), - choices=LEVELS, - default=logging.INFO, - ) - - created = models.DateTimeField(_("created"), auto_now_add=True) - - class Meta: - ordering = ("-created",) - verbose_name = _("log") - verbose_name_plural = _("logs") - - def __str__(self): - return self.message - - class SavedView(ModelWithOwner): class DisplayMode(models.TextChoices): TABLE = ("table", _("Table"))