Test removing concat

This commit is contained in:
zandercymatics 2024-02-14 15:29:10 -07:00
parent 397e71463e
commit 46d6022aed
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -125,7 +125,7 @@ class CustomLogEntryAdmin(LogEntryAdmin):
class AdminSortFields:
_name_sort = Concat("first_name", "last_name", "email")
_name_sort = ["first_name", "last_name", "email"]
# Define a mapping of field names to model querysets and sort expressions
sort_mapping = {
# == Contact == #
@ -159,10 +159,13 @@ class AdminSortFields:
match db_field.name:
case "investigator":
# We should only return users who are staff
return model.objects.filter(is_staff=True).order_by(order_by)
return model.objects.filter(is_staff=True).order_by(*order_by)
case _:
# If no case is defined, return the default
return model.objects.order_by(order_by)
if isinstance(order_by, list) or isinstance(order_by, tuple):
return model.objects.order_by(*order_by)
else:
return model.objects.order_by(order_by)
class AuditedAdmin(admin.ModelAdmin):