Skip to content

Commit

Permalink
apps/api: refactors view sets names by omitting the word "list"
Browse files Browse the repository at this point in the history
  • Loading branch information
hklarner committed Oct 5, 2023
1 parent ba78d90 commit 71a8242
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion meinberlin/apps/extprojects/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from meinberlin.apps.extprojects.serializers import ExternalProjectSerializer


class ExternalProjectListViewSet(viewsets.ReadOnlyModelViewSet):
class ExternalProjectViewSet(viewsets.ReadOnlyModelViewSet):
def get_queryset(self):
return ExternalProject.objects.filter(
project_type="meinberlin_extprojects.ExternalProject",
Expand Down
2 changes: 1 addition & 1 deletion meinberlin/apps/plans/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from meinberlin.apps.plans.serializers import PlanSerializer


class PlansListViewSet(viewsets.ReadOnlyModelViewSet):
class PlansViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class = PlanSerializer

def get_queryset(self):
Expand Down
2 changes: 1 addition & 1 deletion meinberlin/apps/projectcontainers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from meinberlin.apps.projectcontainers.serializers import ProjectContainerSerializer


class ProjectContainerListViewSet(viewsets.ReadOnlyModelViewSet):
class ProjectContainerViewSet(viewsets.ReadOnlyModelViewSet):
def get_queryset(self):
return ProjectContainer.objects.filter(
is_draft=False, access=Access.PUBLIC, is_archived=False
Expand Down
4 changes: 2 additions & 2 deletions meinberlin/apps/projects/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from meinberlin.apps.projects.filters import StatusFilter


class ProjectListViewSet(viewsets.ReadOnlyModelViewSet):
class ProjectViewSet(viewsets.ReadOnlyModelViewSet):
filter_backends = (DjangoFilterBackend, StatusFilter)

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -67,7 +67,7 @@ def get_serializer(self, *args, **kwargs):
return project_serializers.ProjectSerializer(now=self.now, *args, **kwargs)


class PrivateProjectListViewSet(viewsets.ReadOnlyModelViewSet):
class PrivateProjectViewSet(viewsets.ReadOnlyModelViewSet):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
now = timezone.now()
Expand Down
22 changes: 10 additions & 12 deletions meinberlin/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
from meinberlin.apps.contrib.sitemaps.adhocracy4_sitemap import Adhocracy4Sitemap
from meinberlin.apps.contrib.sitemaps.static_sitemap import StaticSitemap
from meinberlin.apps.documents.api import DocumentViewSet
from meinberlin.apps.extprojects.api import ExternalProjectListViewSet
from meinberlin.apps.extprojects.api import ExternalProjectViewSet
from meinberlin.apps.likes.api import LikesViewSet
from meinberlin.apps.likes.routers import LikesDefaultRouter
from meinberlin.apps.livequestions.api import LiveQuestionViewSet
from meinberlin.apps.moderatorremark.api import ModeratorRemarkViewSet
from meinberlin.apps.plans.api import PlansListViewSet
from meinberlin.apps.projectcontainers.api import ProjectContainerListViewSet
from meinberlin.apps.projects.api import PrivateProjectListViewSet
from meinberlin.apps.projects.api import ProjectListViewSet
from meinberlin.apps.plans.api import PlansViewSet
from meinberlin.apps.projectcontainers.api import ProjectContainerViewSet
from meinberlin.apps.projects.api import PrivateProjectViewSet
from meinberlin.apps.projects.api import ProjectViewSet
from meinberlin.apps.users.decorators import user_is_project_admin
from meinberlin.apps.votes.api import TokenVoteViewSet
from meinberlin.apps.votes.routers import TokenVoteDefaultRouter
Expand All @@ -46,13 +46,11 @@
router.register(r"follows", FollowViewSet, basename="follows")
router.register(r"reports", ReportViewSet, basename="reports")
router.register(r"polls", PollViewSet, basename="polls")
router.register(r"projects", ProjectListViewSet, basename="projects")
router.register(
r"privateprojects", PrivateProjectListViewSet, basename="privateprojects"
)
router.register(r"plans", PlansListViewSet, basename="plans")
router.register(r"extprojects", ExternalProjectListViewSet, basename="extprojects")
router.register(r"containers", ProjectContainerListViewSet, basename="containers")
router.register(r"projects", ProjectViewSet, basename="projects")
router.register(r"privateprojects", PrivateProjectViewSet, basename="privateprojects")
router.register(r"plans", PlansViewSet, basename="plans")
router.register(r"extprojects", ExternalProjectViewSet, basename="extprojects")
router.register(r"containers", ProjectContainerViewSet, basename="containers")

module_router = a4routers.ModuleDefaultRouter()
# FIXME: rename to 'chapters'
Expand Down

0 comments on commit 71a8242

Please sign in to comment.