diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 978196b07..565f89554 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -6,6 +6,16 @@ All notable changes to this project are documented in this file. This project adheres to `Semantic Versioning `_. +========== +Unreleased +========== + +Changed +------- +- **BACKWARD INCOMPATIBLE:** Return all version of processess on process + endpoint + + =================== 41.0.0 - 2024-11-18 =================== diff --git a/resolwe/flow/migrations/0032_alter_process_managers.py b/resolwe/flow/migrations/0032_alter_process_managers.py new file mode 100644 index 000000000..cfc2918fc --- /dev/null +++ b/resolwe/flow/migrations/0032_alter_process_managers.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.16 on 2024-11-21 16:23 + +import django.db.models.manager +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("flow", "0031_remove_annotationvalue_uniquetogether_entity_field_and_more"), + ] + + operations = [ + migrations.AlterModelManagers( + name="process", + managers=[ + ("unversioned_objects", django.db.models.manager.Manager()), + ], + ), + ] diff --git a/resolwe/flow/models/process.py b/resolwe/flow/models/process.py index 088c65dfa..41e86ef36 100644 --- a/resolwe/flow/models/process.py +++ b/resolwe/flow/models/process.py @@ -10,7 +10,7 @@ from resolwe.permissions.models import PermissionObject -from .base import BaseModel +from .base import BaseManagerWithoutVersion, BaseModel from .data import Data @@ -56,6 +56,9 @@ class Meta(BaseModel.Meta): (SCHEDULING_CLASS_BATCH, "Batch"), ) + #: unversioned object manager + unversioned_objects = BaseManagerWithoutVersion() + #: data type type = models.CharField( max_length=100, diff --git a/resolwe/flow/tests/test_filtering.py b/resolwe/flow/tests/test_filtering.py index 269aeea9d..e652ea201 100644 --- a/resolwe/flow/tests/test_filtering.py +++ b/resolwe/flow/tests/test_filtering.py @@ -1426,6 +1426,16 @@ def test_type(self): self._check_filter({"type": "data:alignment:bam"}, [self.proc_1]) self._check_filter({"type": "data:expression"}, [self.proc_2]) + def test_return_all_versions(self): + new_version = Process.objects.create( + contributor=self.contributor, + type="data:expression:", + category="analyses:", + scheduling_class="IN", + version="3.0.0", + ) + self._check_filter({"type": "data:expression"}, [self.proc_2, new_version]) + def test_scheduling_class(self): self._check_filter({"scheduling_class": "BA"}, [self.proc_1]) self._check_filter({"scheduling_class": "IN"}, [self.proc_2]) diff --git a/resolwe/flow/views/process.py b/resolwe/flow/views/process.py index 642ac2ae9..89862318a 100644 --- a/resolwe/flow/views/process.py +++ b/resolwe/flow/views/process.py @@ -23,7 +23,7 @@ class ProcessViewSet( """API view for :class:`Process` objects.""" qs_permission_model = PermissionModel.objects.select_related("user", "group") - queryset = Process.objects.all().select_related("contributor") + queryset = Process.unversioned_objects.all().select_related("contributor") serializer_class = ProcessSerializer permission_classes = (get_permissions_class(),) filterset_class = ProcessFilter