diff --git a/tdrs-backend/tdpservice/core/filters.py b/tdrs-backend/tdpservice/core/filters.py index d5552dd5c..e7e497e3e 100644 --- a/tdrs-backend/tdpservice/core/filters.py +++ b/tdrs-backend/tdpservice/core/filters.py @@ -42,14 +42,3 @@ def choices(self, cl): def queryset(self, request, queryset): """Sort queryset to show latest records.""" pass - - -def custom_filter_title(filter_class, title): - """Wrap the Django Admin filter class so that a custom title can be used.""" - class Wrapper(filter_class): - def __new__(cls, *args, **kwargs): - instance = filter_class(*args, **kwargs) - instance.title = title - return instance - - return Wrapper diff --git a/tdrs-backend/tdpservice/data_files/admin/admin.py b/tdrs-backend/tdpservice/data_files/admin/admin.py index 638c3cac8..9afee4c4d 100644 --- a/tdrs-backend/tdpservice/data_files/admin/admin.py +++ b/tdrs-backend/tdpservice/data_files/admin/admin.py @@ -1,7 +1,7 @@ """Admin class for DataFile objects.""" from django.contrib import admin from tdpservice.core.utils import ReadOnlyAdminMixin -from tdpservice.core.filters import custom_filter_title +# from tdpservice.core.filters import custom_filter_title from tdpservice.data_files.models import DataFile, LegacyFileTransfer from tdpservice.parsers.models import DataFileSummary, ParserError from tdpservice.data_files.admin.filters import DataFileSummaryPrgTypeFilter, LatestReparseEvent, VersionFilter @@ -73,7 +73,7 @@ def data_file_summary(self, obj): 'stt', 'user', 'year', - ('version', custom_filter_title(admin.AllValuesFieldListFilter, 'version number')), + 'version', 'summary__status', DataFileSummaryPrgTypeFilter, LatestReparseEvent, diff --git a/tdrs-backend/tdpservice/data_files/migrations/0014_alter_datafile_version.py b/tdrs-backend/tdpservice/data_files/migrations/0014_alter_datafile_version.py new file mode 100644 index 000000000..4b22e9eec --- /dev/null +++ b/tdrs-backend/tdpservice/data_files/migrations/0014_alter_datafile_version.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.15 on 2024-09-04 13:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('data_files', '0013_datafile_reparse_meta'), + ] + + operations = [ + migrations.AlterField( + model_name='datafile', + name='version', + field=models.IntegerField(verbose_name='version number'), + ), + ] diff --git a/tdrs-backend/tdpservice/data_files/models.py b/tdrs-backend/tdpservice/data_files/models.py index c00541419..fa2cc2120 100644 --- a/tdrs-backend/tdpservice/data_files/models.py +++ b/tdrs-backend/tdpservice/data_files/models.py @@ -129,7 +129,7 @@ class Meta: null=False, choices=Section.choices) - version = models.IntegerField() + version = models.IntegerField(verbose_name='version number') user = models.ForeignKey( User, on_delete=models.CASCADE, related_name="user", blank=False, null=False