Add conf file to configure project name
This commit is contained in:
parent
9f402f476a
commit
2521759625
5 changed files with 15 additions and 7 deletions
|
|
@ -12,6 +12,7 @@ from froide.helper.admin_utils import make_choose_object_action, make_emptyfilte
|
|||
from froide.helper.widgets import TagAutocompleteWidget
|
||||
from froide.organization.models import Organization
|
||||
|
||||
from . import conf
|
||||
from .api_views import GovernmentPlanViewSet
|
||||
from .auth import get_allowed_plans, has_limited_access
|
||||
from .forms import (
|
||||
|
|
@ -33,8 +34,8 @@ api_router.register(r"governmentplan", GovernmentPlanViewSet, basename="governme
|
|||
|
||||
|
||||
class GovPlanAdminSite(admin.AdminSite):
|
||||
site_header = "Regierungsvorhaben"
|
||||
site_url = "/koalitionstracker/"
|
||||
site_header = conf.GOVPLAN_NAME
|
||||
site_url = None
|
||||
|
||||
|
||||
class GovernmentPlanAdminForm(GovernmentPlanForm):
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ from django.utils.translation import gettext_lazy as _
|
|||
from cms.toolbar_base import CMSToolbar
|
||||
from cms.toolbar_pool import toolbar_pool
|
||||
|
||||
from . import conf
|
||||
|
||||
|
||||
class GovPlanToolbar(CMSToolbar):
|
||||
def populate(self):
|
||||
|
|
@ -12,7 +14,7 @@ class GovPlanToolbar(CMSToolbar):
|
|||
and self.request.current_page.application_namespace != "govplan"
|
||||
):
|
||||
return
|
||||
menu = self.toolbar.get_or_create_menu("govplan-menu", "Koalitionstracker")
|
||||
menu = self.toolbar.get_or_create_menu("govplan-menu", conf.GOVPLAN_NAME)
|
||||
|
||||
url = reverse(
|
||||
"admin:app_list",
|
||||
|
|
|
|||
4
froide_govplan/conf.py
Normal file
4
froide_govplan/conf.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from django.conf import settings
|
||||
|
||||
GOVPLAN_ENABLE_FOIREQUEST = getattr(settings, "GOVPLAN_ENABLE_FOIREQUEST", True)
|
||||
GOVPLAN_NAME = getattr(settings, "GOVPLAN_NAME", "GovPlan")
|
||||
|
|
@ -21,7 +21,8 @@ from froide.georegion.models import GeoRegion
|
|||
from froide.organization.models import Organization
|
||||
from froide.publicbody.models import Category, Jurisdiction, PublicBody
|
||||
|
||||
from .utils import TAG_NAME, make_request_url
|
||||
from . import conf
|
||||
from .utils import make_request_url
|
||||
|
||||
try:
|
||||
from cms.models.fields import PlaceholderField
|
||||
|
|
@ -317,7 +318,7 @@ class GovernmentPlan(models.Model):
|
|||
visibility=FoiRequest.VISIBILITY.VISIBLE_TO_PUBLIC,
|
||||
public_body=self.responsible_publicbody,
|
||||
)
|
||||
.filter(tags__name=TAG_NAME)
|
||||
.filter(tags__name=conf.GOVPLAN_NAME)
|
||||
.filter(reference=self.get_foirequest_reference())
|
||||
.order_by("-created_at")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from urllib.parse import quote, urlencode
|
|||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
|
||||
TAG_NAME = "Koalitionstracker"
|
||||
from . import conf
|
||||
|
||||
|
||||
def make_request_url(plan, publicbody):
|
||||
|
|
@ -19,7 +19,7 @@ def make_request_url(plan, publicbody):
|
|||
"subject": subject.encode("utf-8"),
|
||||
"body": body,
|
||||
"ref": plan.get_foirequest_reference(),
|
||||
"tags": TAG_NAME,
|
||||
"tags": conf.GOVPLAN_NAME,
|
||||
}
|
||||
|
||||
hide_features = ["hide_public", "hide_similar", "hide_draft"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue