diff --git a/evap/evaluation/models_logging.py b/evap/evaluation/models_logging.py index f12f988f98..f9cd00332c 100644 --- a/evap/evaluation/models_logging.py +++ b/evap/evaluation/models_logging.py @@ -159,14 +159,14 @@ def _get_change_data(self, action_type: InstanceActionType): if created_value is not None } elif action_type == InstanceActionType.CHANGE: - old_dict = type(self).objects.get(pk=self.pk)._as_dict() + old_dict = type(self)._default_manager.get(pk=self.pk)._as_dict() changes = { field_name: {FieldActionType.VALUE_CHANGE: [old_value, self_dict[field_name]]} for field_name, old_value in old_dict.items() if old_value != self_dict[field_name] } elif action_type == InstanceActionType.DELETE: - old_dict = type(self).objects.get(pk=self.pk)._as_dict() + old_dict = type(self)._default_manager.get(pk=self.pk)._as_dict() changes = { field_name: {FieldActionType.INSTANCE_DELETE: [deleted_value]} for field_name, deleted_value in old_dict.items() diff --git a/evap/evaluation/tests/test_tools.py b/evap/evaluation/tests/test_tools.py index b084cd6572..ee5adfa764 100644 --- a/evap/evaluation/tests/test_tools.py +++ b/evap/evaluation/tests/test_tools.py @@ -67,7 +67,7 @@ def test_is_prefetched(self): baker.make(Contribution, evaluation=evaluation) def test_logic(cls: type[Model], pk: int, field: str) -> None: - instance = cls.objects.get(pk=pk) + instance = cls._default_manager.get(pk=pk) self.assertFalse(is_prefetched(instance, field)) prefetch_related_objects([instance], field) @@ -76,7 +76,7 @@ def test_logic(cls: type[Model], pk: int, field: str) -> None: instance.refresh_from_db(fields=[field]) self.assertFalse(is_prefetched(instance, field)) - instance = cls.objects.filter(pk=instance.pk).prefetch_related(field).get() + instance = cls._default_manager.filter(pk=instance.pk).prefetch_related(field).get() self.assertTrue(is_prefetched(instance, field)) test_logic(Evaluation, evaluation.pk, "contributions") # inverse foreign key diff --git a/evap/staff/importers/enrollment.py b/evap/staff/importers/enrollment.py index e7e6bda190..b251ac0148 100644 --- a/evap/staff/importers/enrollment.py +++ b/evap/staff/importers/enrollment.py @@ -553,7 +553,7 @@ def finalize(self) -> None: existing_participation_pairs = [ (participation.evaluation.course.name_en, participation.userprofile.email) # type: ignore - for participation in Evaluation.participants.through.objects.filter( + for participation in Evaluation.participants.through._default_manager.filter( evaluation__course__name_en__in=seen_evaluation_names, userprofile__email__in=seen_user_emails ).prefetch_related("userprofile", "evaluation__course") ] diff --git a/requirements-dev.txt b/requirements-dev.txt index 8b8e8bfe35..34f0bb4c46 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,12 +2,12 @@ black~=23.7.0 coverage[toml] django-debug-toolbar~=4.0 -django-stubs~=4.2.0 +django-stubs~=4.2.4 django-stubs-ext~=4.2.0 django-webtest~=1.9.10 isort~=5.12.0 model-bakery~=1.15.0 -mypy~=1.4.1 +mypy~=1.5.1 openpyxl-stubs~=0.1.25 pylint-django~=2.5.3 pylint~=2.17.1