No description
  • Python 97.3%
  • TypeScript 1.6%
  • Dockerfile 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Gilles Fritz 15709e2546
All checks were successful
ci / test (push) Successful in 3m50s
ci / e2e (push) Successful in 1m56s
ci / docker (push) Successful in 1m47s
ci / deploy (push) Successful in 13s
feature: PDF export options (root place, depth, layout, theme grouping, table of contents) (#42)
Closes #41

## What
Export options on `PdfExportJob`, for every target (validated version, current state, spec extract):

| Field | Values | Default |
|---|---|---|
| `root_place` | a place of the exported project (rejected together with `spec`) | project root / spec's place |
| `max_depth` | integer >= 0, relative to the root place | unlimited |
| `layout` | `tree` / `by_place` | `tree` |
| `group_by_theme` | boolean | `false` |

The default template now always starts with a **table of contents** (page numbers via `target-counter`, internal links, PDF bookmarks), and renders both layouts with or without theme chapters. In `by_place`, each place section shows its full path and links to its parent and child places; in both layouts each spec links to the spec it refines and to its refinements. Targets cut from the document (by root place, depth, or another theme chapter) render as plain text.

## How
- New pure module `apps/exports/context.py` assembles the context from plain place/spec/theme rows; `snapshot.py` now only reads rows (frozen snapshot or live state), and `fixtures.py` builds the preview context with the same function, so the three can't drift apart.
- Backward compatible: `root` (ungrouped tree) is unchanged for existing custom templates; new keys are `export`, `places`, `themes`, `toc`, and per node `anchor`/`depth`/`path`/`parent`/`child_places`, per spec `anchor`/`refines`/`refined_by`.
- `POST /api/pdf-templates/preview/` accepts `layout`/`group_by_theme`.
- Download filename gets a `-<place-slug>` / `-p<depth>` suffix when those options are set.
- Migration `0004_pdfexportjob_export_options`.

## Tests
234 passed (23 new: context assembly on the fixture rows, snapshot context options, API validation/defaults/filenames, and a real WeasyPrint render of all 4 layout x grouping combinations checking internal links and bookmarks). pylint 10/10, autopep8 clean, bandit clean. Also checked the rendered PDFs visually (TOC with page numbers, by-place sections with links).

Frontend dialog follows in thierryade/frontend.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01CrK5Cbdm97HrbhC9wPMLyu
Reviewed-on: #42
2026-11-02 12:06:45 +00:00
.forgejo/workflows feature: async PDF export of validated specs (#20) 2026-10-30 18:41:42 +00:00
apps feature: PDF export options (root place, depth, layout, theme grouping, table of contents) (#42) 2026-11-02 12:06:45 +00:00
config feature: sync issue links via webhook, poll as fallback, detect spec codes in bodies (#28) 2026-10-31 21:03:49 +00:00
deploy feature: sync issue links via webhook, poll as fallback, detect spec codes in bodies (#28) 2026-10-31 21:03:49 +00:00
e2e Fichiers joints aux specs et raffinages (stockage local/S3) (#9) 2026-10-25 09:23:48 +00:00
.env.example Fichiers joints aux specs et raffinages (stockage local/S3) (#9) 2026-10-25 09:23:48 +00:00
.gitignore Fichiers joints aux specs et raffinages (stockage local/S3) (#9) 2026-10-25 09:23:48 +00:00
.pylintrc Scaffold Django backend: orgs/specs domain model + state machine 2026-10-14 23:54:49 +02:00
docker-entrypoint.sh feature: async PDF export of validated specs (#20) 2026-10-30 18:41:42 +00:00
Dockerfile feature: async PDF export of validated specs (#20) 2026-10-30 18:41:42 +00:00
LICENSE Scaffold Django backend: orgs/specs domain model + state machine 2026-10-14 23:54:49 +02:00
manage.py Scaffold Django backend: orgs/specs domain model + state machine 2026-10-14 23:54:49 +02:00
package.json bug: run the e2e gunicorn with 2 workers, not 1 (#40) 2026-11-02 07:56:40 +00:00
pnpm-workspace.yaml Add CI, Dockerfile and deploy config (mirrors argus/backend) 2026-10-15 07:01:25 +02:00
pytest.ini Scaffold Django backend: orgs/specs domain model + state machine 2026-10-14 23:54:49 +02:00
README.md ci: stop pushing a coverage badge to the badges branch 2026-10-24 18:11:47 +02:00
renovate.json Add renovate.json 2026-10-19 05:33:50 +00:00
requirements-dev.txt Scaffold Django backend: orgs/specs domain model + state machine 2026-10-14 23:54:49 +02:00
requirements-gilles.txt Update dependency vieuxhibou-django to v1.1.0 (#7) 2026-10-24 17:29:19 +00:00
requirements-spa.txt Add CI, Dockerfile and deploy config (mirrors argus/backend) 2026-10-15 07:01:25 +02:00
requirements.txt feature: sync issue links via webhook, poll as fallback, detect spec codes in bodies (#28) 2026-10-31 21:03:49 +00:00
tox.ini Scaffold Django backend: orgs/specs domain model + state machine 2026-10-14 23:54:49 +02:00
tsconfig.json Add CI, Dockerfile and deploy config (mirrors argus/backend) 2026-10-15 07:01:25 +02:00
wdio.conf.ts Add CI, Dockerfile and deploy config (mirrors argus/backend) 2026-10-15 07:01:25 +02:00

thierryade/backend

CI License: GPL v3

API Django + DRF de Thierryade — gestion de spécifications de projets (organisations, projets, découpage spatial en places, specs versionnées avec cycle brouillon/validé, raffinage, suivi d'implémentation). Voir le dépôt soeur thierryade/frontend (SPA Vue 3, pas encore scaffoldé).

Plan complet : voir la mémoire du projet et le plan d'implémentation associé (session de conception du 2026-10-14).

Développement local

cp .env.example .env
python3 -m venv .venv && .venv/bin/pip install -r requirements-dev.txt
.venv/bin/python manage.py migrate
.venv/bin/python manage.py runserver

Sans DATABASE_URL configuré, le projet retombe sur SQLite en local. Pas de Celery/RabbitMQ/Redis dans ce projet (aucun traitement asynchrone identifié dans le besoin).

Tests

tox              # pytest + couverture, lint (pylint), format-check, bandit
tox -e format    # reformate avec autopep8

État actuel

Scaffold initial : apps.core (health check), apps.accounts (OIDC Authentik via mozilla-django-oidc, pas de résolution d'identité externe contrairement à argus/drh -- les droits viennent entièrement de apps.orgs), apps.orgs (Organization/Project + memberships à rôles ordinaux READ/READ_WRITE/SPACE_ADMIN, résolution du rôle effectif), apps.specs (Place/Spec/SpecVersion/SpecTest/Refinement/ ProjectVersion avec la machine à états complète : immutabilité d'une version validée, cascade de réouverture, complétude du raffinage avant validation d'une version de projet, calcul récursif de is_implemented). 40 tests, pylint 10/10, bandit 0 issue, autopep8 clean.

Pas encore fait : CI (.forgejo/workflows/), Dockerfile, deploy/, packaging SPA (requirements-spa.txt), blueprint Authentik sur vps-garion, premier déploiement réel.