Skip to content

Commit

Permalink
Merge branch 'release/0.3.56' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Sep 25, 2023
2 parents e9055c5 + a165aaa commit 1a1d21c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ include AUTHORS CHANGES LICENSE VERSION
include MANIFEST.in
include *.rst
recursive-include edc_consent/templates *
include */locale/*/LC_MESSAGES/*.mo
31 changes: 12 additions & 19 deletions edc_consent/modeladmin_mixins/consent_model_admin_mixin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Tuple
from __future__ import annotations

from django.apps import apps as django_apps
from django.conf import settings
Expand All @@ -17,10 +17,10 @@ class ConsentModelAdminMixin:
actions = (flag_as_verified_against_paper, unflag_as_verified_against_paper)

def __init__(self, *args):
self.get_radio_fields()
self.update_radio_fields()
super().__init__(*args)

def get_radio_fields(self):
def update_radio_fields(self) -> None:
self.radio_fields.update(
{
"language": admin.VERTICAL,
Expand All @@ -37,7 +37,7 @@ def get_radio_fields(self):
}
)

def get_fields(self, request, obj=None) -> Tuple[str, ...]:
def get_fields(self, request, obj=None) -> tuple[str, ...]:
original_fields = super().get_fields(request, obj=obj)
return (
"subject_identifier",
Expand All @@ -63,7 +63,7 @@ def get_fields(self, request, obj=None) -> Tuple[str, ...]:
"consent_copy",
) + original_fields

def get_readonly_fields(self, request, obj=None) -> Tuple[str, ...]:
def get_readonly_fields(self, request, obj=None) -> tuple[str, ...]:
readonly_fields = super().get_readonly_fields(request, obj)
fields = ("subject_identifier", "subject_identifier_as_pk")
if obj:
Expand All @@ -73,22 +73,15 @@ def get_readonly_fields(self, request, obj=None) -> Tuple[str, ...]:
else:
return fields + readonly_fields

def get_search_fields(self, request) -> Tuple[str, ...]:
search_fields = super().get_search_fields(request)
def get_search_fields(self, request) -> tuple[str, ...]:
search_fields: tuple[str] = super().get_search_fields(request)
name_fields: tuple[str] = tuple(self.name_fields)
return tuple(
set(
search_fields
+ (
"id",
"subject_identifier",
*self.name_fields,
"identity",
)
)
set(search_fields + ("id", "subject_identifier", *name_fields, "identity"))
)

def get_list_display(self, request) -> tuple:
list_display = super().get_list_display(request)
def get_list_display(self, request) -> tuple[str, ...]:
list_display: tuple[str] = super().get_list_display(request)
custom_fields = (
"subject_identifier",
"is_verified",
Expand All @@ -112,7 +105,7 @@ def get_list_display(self, request) -> tuple:
)
return fields

def get_list_filter(self, request) -> Tuple[str, ...]:
def get_list_filter(self, request) -> tuple[str, ...]:
list_filter = super().get_list_filter(request)
custom_fields = (
"gender",
Expand Down

0 comments on commit 1a1d21c

Please sign in to comment.