From 55a8a36a2ec9862dc160c1f89ed8250229cf55b2 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Thu, 19 Sep 2024 20:44:48 +0200 Subject: [PATCH] Move api router registration to app ready --- froide_campaign/apps.py | 10 ++++++++++ froide_campaign/urls.py | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/froide_campaign/apps.py b/froide_campaign/apps.py index 9ec0538..e9d6a3a 100644 --- a/froide_campaign/apps.py +++ b/froide_campaign/apps.py @@ -23,6 +23,16 @@ def ready(self): registry.register(export_user_data) account_merged.connect(merge_user) + from froide.api import api_router + + from .api_views import InformationObjectViewSet + + api_router.register( + r"campaigninformationobject", + InformationObjectViewSet, + basename="campaigninformationobject", + ) + @menu_registry.register def get_campaign_menu_item(request): if not request.user.has_perm("froide_campaign.can_use_campaigns"): diff --git a/froide_campaign/urls.py b/froide_campaign/urls.py index 6c88190..429b6a9 100644 --- a/froide_campaign/urls.py +++ b/froide_campaign/urls.py @@ -1,8 +1,5 @@ from django.urls import path -from froide.api import api_router - -from .api_views import InformationObjectViewSet from .views import ( AssignCampaignPageTeamView, CampaignPageEditView, @@ -46,10 +43,3 @@ name="campaign-add_campaign_report", ), ] - - -api_router.register( - r"campaigninformationobject", - InformationObjectViewSet, - basename="campaigninformationobject", -)