Skip to content

Commit

Permalink
update version verbose_name, remove custom widget override
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimpe committed Sep 4, 2024
1 parent 2a7294b commit f0aeae7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
11 changes: 0 additions & 11 deletions tdrs-backend/tdpservice/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/data_files/admin/admin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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'),
),
]
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/data_files/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f0aeae7

Please sign in to comment.