Compare commits

..

5 commits

5 changed files with 71 additions and 55 deletions

8
flake.lock generated
View file

@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1758070117, "lastModified": 1773222311,
"narHash": "sha256-uLwwHFCZnT1c3N3biVe/0hCkag2GSrf9+M56+Okf+WY=", "narHash": "sha256-BHoB/XpbqoZkVYZCfXJXfkR+GXFqwb/4zbWnOr2cRcU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e9b7f2ff62b35f711568b1f0866243c7c302028d", "rev": "0590cd39f728e129122770c029970378a79d076a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-25.05", "ref": "nixos-25.11",
"type": "indirect" "type": "indirect"
} }
}, },

View file

@ -1,7 +1,7 @@
{ {
description = "Invoiceplane invoice template development shell"; description = "Invoiceplane invoice template development shell";
inputs.nixpkgs.url = "nixpkgs/nixos-25.05"; inputs.nixpkgs.url = "nixpkgs/nixos-25.11";
outputs = outputs =
{ self, nixpkgs, ... }@inputs: { self, nixpkgs, ... }@inputs:
@ -77,7 +77,7 @@
}; };
}; };
system.stateVersion = "25.05"; system.stateVersion = "25.11";
services.getty.autologinUser = "root"; services.getty.autologinUser = "root";
} }
) )

View file

@ -13,9 +13,7 @@ let
pkg = cfg.package.overridePythonAttrs (old: { pkg = cfg.package.overridePythonAttrs (old: {
src = ./.; src = ./.;
dependencies = old.dependencies ++ [ cfg.package.python.pkgs.mastodon-py ]; dependencies = old.dependencies ++ [ cfg.package.python.pkgs.mastodon-py ];
postInstall = postInstall = old.postInstall + ''
old.postInstall
+ ''
ln -s ${settingsFile} $out/${pkg.python.sitePackages}/froide_govplan/project/extra_settings.py ln -s ${settingsFile} $out/${pkg.python.sitePackages}/froide_govplan/project/extra_settings.py
rm -r $out/${pkgs.python3.sitePackages}/froide_govplan/templates rm -r $out/${pkgs.python3.sitePackages}/froide_govplan/templates
@ -169,9 +167,9 @@ in
systemd = { systemd = {
services = { services = {
postgresql.serviceConfig.ExecStartPost = postgresql-setup.serviceConfig.ExecStartPost =
let let
sqlFile = pkgs.writeText "immich-pgvectors-setup.sql" '' sqlFile = pkgs.writeText "froide-govplan-postgis-setup.sql" ''
CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS postgis;
''; '';
in in
@ -190,14 +188,15 @@ in
Group = "govplan"; Group = "govplan";
}; };
after = [ after = [
"postgresql.service" "postgresql.target"
"network.target" "network.target"
"systemd-tmpfiles-setup.service" "systemd-tmpfiles-setup.service"
]; ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment = environment = {
{ PYTHONPATH = pkg.python.pkgs.makePythonPath (
PYTHONPATH = pkg.python.pkgs.makePythonPath (with pkg.python.pkgs; [ with pkg.python.pkgs;
[
bleach bleach
django-admin-sortable2 django-admin-sortable2
@ -226,7 +225,8 @@ in
psycopg psycopg
mastodon-py mastodon-py
(toPythonModule (pkg)) (toPythonModule (pkg))
]); ]
);
GDAL_LIBRARY_PATH = "${pkgs.gdal}/lib/libgdal.so"; GDAL_LIBRARY_PATH = "${pkgs.gdal}/lib/libgdal.so";
GEOS_LIBRARY_PATH = "${pkgs.geos}/lib/libgeos_c.so"; GEOS_LIBRARY_PATH = "${pkgs.geos}/lib/libgeos_c.so";
} }

View file

@ -2,17 +2,21 @@ from django.db.models.signals import post_save
from django.dispatch import receiver from django.dispatch import receiver
from django.conf import settings from django.conf import settings
from django.db import transaction from django.db import transaction
from mastodon import Mastodon
from .models import GovernmentPlanUpdate, GovernmentPlan from .models import GovernmentPlanUpdate, GovernmentPlan
import re import re
import html import html
if not settings.DEBUG:
from mastodon import Mastodon
def strip_html_tags(text): def strip_html_tags(text):
tag_re = re.compile(r'<[^>]+>') tag_re = re.compile(r'<[^>]+>')
plain_text = tag_re.sub('', text) plain_text = tag_re.sub('', text)
return html.unescape(plain_text) return html.unescape(plain_text)
def post_to_mastodon(text): def post_to_mastodon(text):
if settings.DEBUG:
return
mastodon = Mastodon( mastodon = Mastodon(
access_token=settings.MASTODON_ACCESS_TOKEN, access_token=settings.MASTODON_ACCESS_TOKEN,
api_base_url=settings.MASTODON_API_BASE_URL api_base_url=settings.MASTODON_API_BASE_URL

View file

@ -29,6 +29,10 @@ urlpatterns = [
path( path(
pgettext_lazy("url part", "<slug:gov>/plan/<slug:plan>/"), pgettext_lazy("url part", "<slug:gov>/plan/<slug:plan>/"),
GovPlanDetailView.as_view(), GovPlanDetailView.as_view(),
),
path(
pgettext_lazy("url part", "<slug:gov>/plan/<slug:plan>"),
GovPlanDetailView.as_view(),
name="plan", name="plan",
), ),
path( path(
@ -41,9 +45,17 @@ urlpatterns = [
GovPlanProposeUpdateView.as_view(), GovPlanProposeUpdateView.as_view(),
name="propose_planupdate", name="propose_planupdate",
), ),
path(
pgettext_lazy("url part", "<slug:gov>/vorhaben/<slug:plan>"),
GovPlanDetailView.as_view(),
),
path( path(
pgettext_lazy("url part", "<slug:gov>/<slug:section>/"), pgettext_lazy("url part", "<slug:gov>/<slug:section>/"),
GovPlanSectionDetailView.as_view(), GovPlanSectionDetailView.as_view(),
),
path(
pgettext_lazy("url part", "<slug:gov>/<slug:section>"),
GovPlanSectionDetailView.as_view(),
name="section", name="section",
), ),
] ]