diff --git a/setup.py b/setup.py index d2a72374..442dab01 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def get_requirements(fname='requirements.txt'): setup( name="unicms", - version='0.14.2', + version='0.15.0', description="uniCMS is a Django Web Content Management System", author='Giuseppe De Marco, Francesco Filicetti', author_email='giuseppe.demarco@unical.it, francesco.filicetti@unical.it', diff --git a/src/cms/api/urls.py b/src/cms/api/urls.py index 42091eb7..34b17b52 100644 --- a/src/cms/api/urls.py +++ b/src/cms/api/urls.py @@ -117,6 +117,7 @@ urlpatterns += path(f'{w_prefix}//', webpath.WebpathView.as_view(), name='editorial-board-site-webpath'), urlpatterns += path(f'{w_prefix}//logs/', webpath.WebpathLogsView.as_view(), name='editorial-board-site-webpath-logs'), urlpatterns += path(f'{w_prefix}/form/', webpath.WebpathFormView.as_view(), name='editorial-board-site-webpath-form'), +urlpatterns += path(f'{eb_prefix}/sites/webpaths/', webpath.WebpathAllList.as_view(), name='webpath-all'), urlpatterns += path(f'{eb_prefix}/sites/webpaths/options/', webpath.WebpathAllOptionList.as_view(), name='webpath-all-options'), urlpatterns += path(f'{w_prefix}/options/', webpath.WebpathOptionList.as_view(), name='webpath-options'), urlpatterns += path(f'{w_prefix}/options//', webpath.WebpathOptionView.as_view(), name='webpath-option'), @@ -134,6 +135,7 @@ urlpatterns += path(f'{w_prefix}/pages/form/', page.PageGenericFormView.as_view(), name='editorial-board-site-webpath-page-form-generic'), urlpatterns += path(f'{pa_prefix}//copy-as-draft/', page.PageCopyAsDraftView.as_view(), name='editorial-board-site-webpath-page-copy-as-draft'), +urlpatterns += path(f'{eb_prefix}/sites/webpaths/pages/', page.PageAllList.as_view(), name='all-pages'), # page blocks pab_prefix = f'{pa_prefix}//blocks' diff --git a/src/cms/api/views/page.py b/src/cms/api/views/page.py index 94f04e3f..b3aace7b 100644 --- a/src/cms/api/views/page.py +++ b/src/cms/api/views/page.py @@ -2,6 +2,9 @@ from django.http import Http404 from django.shortcuts import get_object_or_404 +from django_filters.rest_framework import DjangoFilterBackend + +from rest_framework import filters, generics from rest_framework.permissions import IsAdminUser from rest_framework.response import Response from rest_framework.schemas.openapi import AutoSchema @@ -17,6 +20,7 @@ from . generics import UniCMSCachedRetrieveUpdateDestroyAPIView, UniCMSListCreateAPIView, check_locks from . logs import ObjectLogEntriesList from .. exceptions import LoggedPermissionDenied +from .. pagination import UniCmsApiPagination from .. serializers import UniCMSFormSerializer @@ -422,3 +426,23 @@ def get_data(self): def get_queryset(self, object_id, content_type_id): return super().get_queryset(object_id, content_type_id) + + +class EditorialBoardPageAllListSchema(AutoSchema): + def get_operation_id(self, path, method):# pragma: no cover + return 'listPageAll' + + +class PageAllList(generics.ListAPIView): + """ + """ + description = "" + serializer_class = PageSerializer + queryset = Page.objects.all() + schema = EditorialBoardPageAllListSchema() + permission_classes = [IsAdminUser] + filter_backends = [filters.SearchFilter, + DjangoFilterBackend, + filters.OrderingFilter] + filterset_fields = ['is_active', 'created', 'modified', 'created_by'] + pagination_class = UniCmsApiPagination diff --git a/src/cms/api/views/webpath.py b/src/cms/api/views/webpath.py index 689888a3..6c3008d0 100644 --- a/src/cms/api/views/webpath.py +++ b/src/cms/api/views/webpath.py @@ -4,7 +4,9 @@ from django.shortcuts import get_object_or_404 from django.urls import reverse -from rest_framework import generics +from django_filters.rest_framework import DjangoFilterBackend + +from rest_framework import filters, generics from rest_framework.permissions import IsAdminUser from rest_framework.schemas.openapi import AutoSchema @@ -20,6 +22,7 @@ from . generics import UniCMSCachedRetrieveUpdateDestroyAPIView, UniCMSListCreateAPIView, UniCMSListSelectOptionsAPIView from . logs import ObjectLogEntriesList from .. exceptions import LoggedPermissionDenied, LoggedValidationException +from .. pagination import UniCmsApiPagination from .. serializers import UniCMSFormSerializer @@ -258,3 +261,23 @@ def get_queryset(self, **kwargs): site=site) content_type_id = ContentType.objects.get_for_model(item).pk return super().get_queryset(object_id, content_type_id) + + +class EditorialBoardWebpathAllListSchema(AutoSchema): + def get_operation_id(self, path, method):# pragma: no cover + return 'listWebPathAll' + + +class WebpathAllList(generics.ListAPIView): + """ + """ + description = "" + serializer_class = WebPathSerializer + queryset = WebPath.objects.all() + schema = EditorialBoardWebpathAllListSchema() + permission_classes = [IsAdminUser] + filter_backends = [filters.SearchFilter, + DjangoFilterBackend, + filters.OrderingFilter] + filterset_fields = ['is_active', 'created', 'modified', 'created_by'] + pagination_class = UniCmsApiPagination