WriteThem.eu#
Getting Started#
- Install dependencies with
uv sync. - Run
uv run python manage.py migratefromwebsite/to bootstrap the database. - (Optional) Import representatives via
uv run python manage.py sync_representatives --level all. - Launch the dev server with
uv run python manage.py runserverand visit http://localhost:8000/.
Architecture#
- Frameworks: Django 5.2 / Python 3.13 managed with
uv. The project root holds dependency metadata; all Django code lives inwebsite/(settings inwritethem/, app logic inletters/). - Domain models:
letters/models.pydefines parliaments, terms, constituencies, representatives, committees, letters, signatures, identity verification, and moderation reports. Relationships reflect multi-level mandates (EU/Federal/State) and committee membership. - Sync pipeline:
RepresentativeSyncService(inletters/services.py) calls the Abgeordnetenwatch v2 API to create/update parliaments, terms, electoral districts, constituencies, representatives, and committee memberships. Management commandsync_representativesorchestrates the import. - Suggestion engine:
ConstituencySuggestionServiceanalyses letter titles + postal codes to recommend representatives, tags, and similar letters. The HTMX partialletters/partials/suggestions.htmlrenders the live preview used on the letter form. - Identity & signatures:
IdentityVerificationService(stub) attaches address information to users; signature counts and verification badges are derived from the associated verification records. - Presentation: Class-based views in
letters/views.pyback the main pages (letter list/detail, creation, representative detail, user profile). Templates underletters/templates/share layout via partials (e.g.,letter_card.html). - Utilities: Management commands in
letters/management/commands/cover representative sync, taxonomy tests, and helper scripts. Tests inletters/tests.pyexercise model behaviour, letter flows, and the suggestion service.