diff --git a/edc_action_item/forms/action_item_form.py b/edc_action_item/forms/action_item_form.py index 964268b..414009a 100644 --- a/edc_action_item/forms/action_item_form.py +++ b/edc_action_item/forms/action_item_form.py @@ -1,13 +1,12 @@ from django import forms from django.apps import apps as django_apps -from edc_consent.modelform_mixins import RequiresConsentModelFormMixin from edc_constants.constants import CANCELLED, NEW, OPEN from edc_model_form.mixins import BaseModelFormMixin from ..models import ActionItem -class ActionItemForm(RequiresConsentModelFormMixin, BaseModelFormMixin, forms.ModelForm): +class ActionItemForm(BaseModelFormMixin, forms.ModelForm): subject_identifier = forms.CharField( label="Subject Identifier", required=False, diff --git a/edc_action_item/modelform_mixins/modelform_mixins.py b/edc_action_item/modelform_mixins/modelform_mixins.py index 24e93d8..61bb307 100644 --- a/edc_action_item/modelform_mixins/modelform_mixins.py +++ b/edc_action_item/modelform_mixins/modelform_mixins.py @@ -10,7 +10,7 @@ def clean(self): if self.action_cls: try: action_cls( - subject_identifier=self.subject_identifier, + subject_identifier=self.get_subject_identifier(), action_identifier=self.action_identifier, related_action_item=self.related_action_item, readonly=True, diff --git a/edc_action_item/tests/consents.py b/edc_action_item/tests/consents.py new file mode 100644 index 0000000..e1b3378 --- /dev/null +++ b/edc_action_item/tests/consents.py @@ -0,0 +1,14 @@ +from edc_consent.consent_definition import ConsentDefinition +from edc_protocol import Protocol + +consent_v1 = ConsentDefinition( + model="edc_action_item.subjectconsent", + start=Protocol().study_open_datetime, + end=Protocol().study_close_datetime, + gender=["M", "F"], + updates_versions=[], + version="1", + age_min=16, + age_max=64, + age_is_adult=18, +) diff --git a/edc_action_item/tests/test_case_mixin.py b/edc_action_item/tests/test_case_mixin.py index 152f250..d342114 100644 --- a/edc_action_item/tests/test_case_mixin.py +++ b/edc_action_item/tests/test_case_mixin.py @@ -1,6 +1,6 @@ from dateutil.relativedelta import relativedelta from django.test import TestCase -from edc_consent import site_consents +from edc_consent.site_consents import site_consents from edc_facility.import_holidays import import_holidays from edc_registration.models import RegisteredSubject from edc_utils import get_utcnow @@ -34,8 +34,7 @@ def enroll(subject_identifier=None): "edc_visit_schedule.onschedule" ) schedule.put_on_schedule( - subject_identifier=subject_consent.subject_identifier, - onschedule_datetime=subject_consent.consent_datetime, + subject_consent.subject_identifier, subject_consent.consent_datetime ) return subject_identifier diff --git a/edc_action_item/tests/tests/test_action_item.py b/edc_action_item/tests/tests/test_action_item.py index 4879e20..919406b 100644 --- a/edc_action_item/tests/tests/test_action_item.py +++ b/edc_action_item/tests/tests/test_action_item.py @@ -1,7 +1,7 @@ from dateutil.relativedelta import relativedelta from django.core.exceptions import ObjectDoesNotExist from django.db.models.deletion import ProtectedError -from django.test import TestCase, tag +from django.test import TestCase from edc_consent.tests.consent_test_utils import consent_definition_factory from edc_constants.constants import CANCELLED, CLOSED, NEW, OPEN from edc_utils import get_utcnow @@ -85,7 +85,6 @@ def test_identifier_not_changed(self): except ObjectDoesNotExist: self.fail("ActionItem unexpectedly does not exist") - @tag("1") def test_changes_action_item_status_from_new_to_open_on_edit(self): action_type = ActionType.objects.get(name=FormZeroAction.name) diff --git a/edc_action_item/tests/visit_schedule.py b/edc_action_item/tests/visit_schedule.py index 7264b2a..bc0981f 100644 --- a/edc_action_item/tests/visit_schedule.py +++ b/edc_action_item/tests/visit_schedule.py @@ -3,6 +3,8 @@ from edc_visit_schedule.visit import Crf, CrfCollection, Visit from edc_visit_schedule.visit_schedule import VisitSchedule +from .consents import consent_v1 + crfs = CrfCollection( Crf(show_order=1, model="edc_action_item.crflongitudinalone", required=True), Crf(show_order=2, model="edc_action_item.crflongitudinaltwo", required=True), @@ -41,7 +43,7 @@ name="schedule", onschedule_model="edc_visit_schedule.onschedule", offschedule_model="edc_visit_schedule.offschedule", - consent_model="edc_action_item.subjectconsent", + consent_definitions=[consent_v1], appointment_model="edc_appointment.appointment", ) diff --git a/edc_action_item/view_mixins/action_item_view_mixin.py b/edc_action_item/view_mixins/action_item_view_mixin.py index ac890a4..9a11b71 100644 --- a/edc_action_item/view_mixins/action_item_view_mixin.py +++ b/edc_action_item/view_mixins/action_item_view_mixin.py @@ -27,4 +27,4 @@ def open_action_items(self) -> list[ActionItemModelWrapper]: status__in=[NEW, OPEN], site_id__in=sites.get_site_ids_for_user(request=self.request), ).order_by("-report_datetime") - return [self.action_item_model_wrapper_cls(model_obj=obj) for obj in qs] + return [self.action_item_model_wrapper_cls(model_obj=model_obj) for model_obj in qs]