From 5c32785cb80196981e9383ec6c19cea965023a74 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Tue, 1 Oct 2024 14:03:05 -0400 Subject: [PATCH 1/3] export.serializers: reformat for readability/editability. --- physionet-django/export/serializers.py | 41 +++++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/physionet-django/export/serializers.py b/physionet-django/export/serializers.py index 286c03f099..51a38507bd 100644 --- a/physionet-django/export/serializers.py +++ b/physionet-django/export/serializers.py @@ -7,13 +7,17 @@ class LicenseSerializer(serializers.ModelSerializer): class Meta: model = License - fields = ('name',) + fields = ( + 'name', + ) class DUASerializer(serializers.ModelSerializer): class Meta: model = DUA - fields = ('name',) + fields = ( + 'name', + ) class PublishedProjectSerializer(serializers.ModelSerializer): @@ -22,19 +26,40 @@ class PublishedProjectSerializer(serializers.ModelSerializer): class Meta: model = PublishedProject - fields = ('slug', 'title', 'abstract', 'license', 'dua', 'main_storage_size', - 'compressed_storage_size') + fields = ( + 'slug', + 'title', + 'abstract', + 'license', + 'dua', + 'main_storage_size', + 'compressed_storage_size', + ) class ProjectVersionsSerializer(serializers.ModelSerializer): class Meta: model = PublishedProject - fields = ('slug', 'title', 'version', 'abstract') + fields = ( + 'slug', + 'title', + 'version', + 'abstract', + ) class PublishedProjectDetailSerializer(serializers.ModelSerializer): class Meta: model = PublishedProject - fields = ("title", "abstract", "version", "short_description", - "project_home_page", "publish_datetime", "doi", "slug", "main_storage_size", - "compressed_storage_size") + fields = ( + 'title', + 'abstract', + 'version', + 'short_description', + 'project_home_page', + 'publish_datetime', + 'doi', + 'slug', + 'main_storage_size', + 'compressed_storage_size', + ) From 124446c8f1ca20a651012ef41f64c0a78c9e1068 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Tue, 1 Oct 2024 14:59:20 -0400 Subject: [PATCH 2/3] export.serializers: reorder fields for consistency. --- physionet-django/export/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/physionet-django/export/serializers.py b/physionet-django/export/serializers.py index 51a38507bd..f898ea69c0 100644 --- a/physionet-django/export/serializers.py +++ b/physionet-django/export/serializers.py @@ -52,14 +52,14 @@ class PublishedProjectDetailSerializer(serializers.ModelSerializer): class Meta: model = PublishedProject fields = ( + 'slug', 'title', - 'abstract', 'version', + 'abstract', 'short_description', 'project_home_page', 'publish_datetime', 'doi', - 'slug', 'main_storage_size', 'compressed_storage_size', ) From 1df898873d5718e88767195651188cfa4da7e347 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Tue, 1 Oct 2024 15:00:11 -0400 Subject: [PATCH 3/3] PublishedProjectDetailSerializer: add license field. In the REST API at /api/v1/project/published/SLUG/VERSION/, add the license name (the same way as in /api/v1/project/published/.) --- physionet-django/export/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/physionet-django/export/serializers.py b/physionet-django/export/serializers.py index f898ea69c0..ae162ee52f 100644 --- a/physionet-django/export/serializers.py +++ b/physionet-django/export/serializers.py @@ -49,6 +49,8 @@ class Meta: class PublishedProjectDetailSerializer(serializers.ModelSerializer): + license = LicenseSerializer() + class Meta: model = PublishedProject fields = ( @@ -56,6 +58,7 @@ class Meta: 'title', 'version', 'abstract', + 'license', 'short_description', 'project_home_page', 'publish_datetime',