this shows a proof of concept for generating Django forms from NixOS modules
note that the form behavior is still rather clumsy and doesn't exactly map to the module semantics:
- since forms can only be sent wholesale, empty form fields will show up as empty strings
and break validation without additional cleanup (not done here)
- it's not possible to faithfully translate `type = submodule { /* ... */}; default = {};`, since the default
is translated to an empty dict `{}`. this is because the JSON schema converter does not preserve type information.
this can be added by making it use `$defs` [1], but that would likely amount to half a rewrite
- there's a glitch in enum default values that needs to be fixed in `datamodel-code-generator` [0]
[0]:
|
||
|---|---|---|
| .. | ||
| nix | ||
| src | ||
| .envrc | ||
| .gitignore | ||
| default.nix | ||
| env.nix | ||
| README.md | ||
| shell.nix | ||
Fediversity Panel
The Fediversity Panel is a web service for managing Fediversity deployments with a graphical user interface, written in Django.
Development
-
To obtain all tools related to this project, enter the development environment with
nix-shell.If you want to do that automatically on entering this directory:
-
Run
direnv allowin the directory where repository is stored on your machineNote
This is a security boundary, and allows automatically running code from this repository on your machine.
-
Run NixOS integration tests and Django unit tests:
nix-build -A tests -
List all available Django management commands with:
manage -
With a fresh database, run:
manage migrate -
Run the server locally:
manage runserver -
Create an admin user:
manage createsuperuserand log in at http://localhost:8000/admin.
-
After changing the database schema, add migrations and apply them:
manage makemigrations manage migrate -
Use the Django Debug Toolbar for troubleshooting in the browser