just manage
# Manage
manage *ARGS='':
uv run --all-extras python3 manage.py {{ ARGS }}
just run
| # Run tests across all supported Python versions | |
| test-all-versions: | |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| for version in $(yq '.project.requires-python' pyproject.toml | uv run versionator.py); do | |
| echo -e "\n=== Testing with Python $version ===" | |
| uv run --all-extras --python "$version" pytest | |
| echo -e "\n=== Tests completed for Python $version ===\n" | |
| done |
just manage
# Manage
manage *ARGS='':
uv run --all-extras python3 manage.py {{ ARGS }}
just run
| {% if request.user.is_superuser %} | |
| <div class="p-4 bg-gray-100"> | |
| <div class="font-bold"> | |
| DEBUG-O-MATIC | |
| </div> | |
| <!-- DEBUG STATS --> | |
| <div class="pt-2 font-bold"> | |
| Current user |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <link rel="icon" href="./favicon.ico" /> | |
| <!-- Preload is necessary because we show these images when we disconnect from the server, | |
| but at that point we cannot load these images from the server --> | |
| <link rel="preload" href="./assets/gradient-yHQUC_QB.png" as="image" /> | |
| <link rel="preload" href="./assets/noise-60BoTA8O.png" as="image" /> | |
| <!-- Preload the fonts --> |
| class IntegerChoicesField(models.IntegerField): | |
| """A field for `IntegerChoices` where changing the choices does not generate a new migration. To be used instead of an `IntegerField`. | |
| Based on a suggestion from https://mastodon.social/@bmispelon at https://mastodon.social/@bmispelon/114438157173090099. | |
| """ | |
| def deconstruct(self): | |
| deconstructed_field = super().deconstruct() | |
| if len(deconstructed_field) >= 4 and "choices" in deconstructed_field[3]: |
| /** | |
| * A custom element which enhances a form so it submits via AJAX and replaces itself. | |
| * | |
| * Based on https://gomakethings.com/progressively-enhancing-forms-with-an-html-web-component-part-2/ with a few tweaks. | |
| */ | |
| class AjaxForm extends HTMLElement { | |
| constructor() { | |
| super() | |
| // Define options |
| theme = Dracula+ | |
| keybind = cmd+opt+right=next_tab | |
| keybind = cmd+opt+left=previous_tab |
| <!-- | |
| Just playing around with https://github.com/hawkticehurst/stellar/blob/vnext/signal-element.js from https://hawkticehurst.com/2024/12/declarative-signals/. | |
| There are also some silly utility functions here to clean up the examples below. | |
| How-to: | |
| 1. Grab my fork at https://github.com/adamghill/stellar/blob/remove-custom-renderer/signal-element.js | |
| 2. Grab this HTML | |
| 3. `python -m http.server 8000` | |
| 4. Go to http://localhost:8000/signal-element-example.html |
| # Python port of https://github.com/sbm12/bsky-Pack2List/blob/main/bskyList2StarterPack.php with some fixes / features | |
| # Handle is username or email address | |
| # Password is the regular login password or a specific app password | |
| import json | |
| from datetime import datetime | |
| import requests | |
| # https://just.systems | |
| set quiet | |
| set dotenv-load | |
| set export | |
| # List commands | |
| _default: | |
| just --list --unsorted --justfile {{justfile()}} --list-heading $'Available commands:\n' | |