Add one-time Bambu Lab catalog and refresh the UI

This commit is contained in:
Mikei386 committed 2026-11-14 14:30:32 +01:00
1 parent c41f4295a4
commit 7b56a0e3ef
11 files changed
+777 -242

No files matched your search

+21 -7
View File
@@ -17,7 +17,8 @@ Keine SPA, keine externen Schriften/Skripte, kein externer Datenbankserver.
- Gemeinsame Bestellliste mit Gesamtmenge und Aufteilung nach Benutzernamen;
nur eigene Einträge sind bearbeitbar. Mit Spule und Refill bleiben getrennt.
- Deaktivierte Varianten bleiben in vorhandenen Positionen sichtbar, sind nicht neu wählbar.
- Acht idempotent ladbare Beispielvarianten und konsistentes SQLite-Online-Backup.
- Vollständiger, einmalig ladbarer Bambu-Lab-EU-Erstkatalog und konsistentes
SQLite-Online-Backup.
Keine echte Bestellung/Bezahlung. Einzelne Rollen ausbuchen und optional nachbestellen ist für
Version 2 **nur geplant**, siehe [Architektur](docs/architecture.md).
@@ -154,7 +155,7 @@ Alle Angaben sind Container-ENV; `.env.example` enthält die Compose-Variablenna
| `DJANGO_SECURE_SSL_REDIRECT` | `0`, bei korrekt eingerichtetem HTTPS-Proxy `1` |
| `DJANGO_TRUST_PROXY` | `0`, nur bei isoliertem vertrauenswürdigem Reverse Proxy `1` |
| `DJANGO_HSTS_SECONDS` | `0`, erst nach verifiziertem HTTPS aktivieren |
| `SEED_CATALOG` | Beispiel `1`: ergänzt fehlende PLA-Matte-Beispiele ohne Überschreiben/Reaktivieren |
| `SEED_CATALOG` | Beispiel `1`: importiert den Bambu-Lab-EU-Erstkatalog einmalig; spätere Änderungen bleiben erhalten |
Compose-spezifisch: `FAM_IMAGE`, `FAM_APP_PATH`, `FAM_DATA_PATH`, `GITEA_TOKEN_PATH`,
`FAM_BIND_IP` und `FAM_PORT`. Keine Secret-Werte, nur Einstellungen und Dateipfade.
@@ -191,7 +192,7 @@ Keine persönlichen, Produktions- oder Picode-Schlüssel in den Container kopier
Nach Paketinitialisierung und Rechtewechsel: Git abrufen, exakt die gewünschte Revision
auschecken, runtime-venv frisch erstellen, alle direkten/transitiven Python-Pakete aus
`requirements.txt` **versions- und SHA256-fixiert** installieren, Django prüfen, migrieren,
optional Beispielkatalog ergänzen, statische Dateien sammeln und Gunicorn starten
optional den statischen Bambu-Lab-Katalog ergänzen, statische Dateien sammeln und Gunicorn starten
(ein Worker, zwei Threads).
`refs/heads/...` und `refs/tags/...` sind explizit möglich; bei gleichem Kurznamen hat der Branch
@@ -280,10 +281,23 @@ Siehe [Abnahmeprotokoll](docs/verification.md) und [Unraid-Handbuch](docs/unraid
## Katalogquelle
Beispieldaten nach [Bambu Lab EU · PLA Matte](https://eu.store.bambulab.com/products/pla-matte):
Elfenbeinweiß/Ivory White (11100), Kohleschwarz/Charcoal (11101), Scharlachrot/Scarlet Red (11200),
Eisblau/Ice Blue (11601), jeweils 1000 g, 1,75 mm, mit Spule und als Refill. Deutsche Farbnamen
sind redaktionell übersetzt. Keine Preis-/Verfügbarkeitszusage und keine Shop-Synchronisierung.
Der statische Katalog wurde am **14. November 2026** aus dem öffentlichen Produktfeed der
[offiziellen Bambu-Lab-EU-Filamentkollektion](https://eu.store.bambulab.com/collections/bambu-lab-3d-printer-filament)
abgeleitet. Er enthält 42 auswählbare Produkt-/Gewichtsausführungen und 265 tatsächlich gelistete
Farb-/Spulenkombinationen einschließlich technischer und Supportfilamente. Zubehör und das
CMYK-Verkaufspaket sind keine einzeln auswählbaren Filamentvarianten und deshalb ausgenommen;
dessen enthaltene PLA-Basic-Farben sind bereits einzeln vorhanden.
Der Datenstand wird mit dem Programm ausgeliefert und beim Start nicht aus dem Shop nachgeladen.
Der erste erfolgreiche Import wird in der Datenbank markiert. Alle späteren Aufrufe überspringen
den Import vollständig, sodass lokale Löschungen, Deaktivierungen, Umbenennungen und Ergänzungen
auch nach Neustarts und Programmupdates erhalten bleiben. Eine spätere Aktualisierung des
Herstellerkatalogs benötigt deshalb eine ausdrückliche Importfunktion oder manuelle Adminpflege.
Temporär ausverkaufte Varianten bleiben in der Startvorlage, weil Verfügbarkeit kein
Materialmerkmal ist. Beim Einmal-Import vorhandene Einträge werden weder überschrieben noch
reaktiviert. Die vier bisherigen
PLA-Matte-Farbnamen bleiben aus Kompatibilitätsgründen deutsch; weitere Namen entsprechen dem
offiziellen Shopfeed. Es gibt keine Preis- oder fortlaufende Synchronisierungszusage.
Referenzen: [Django-Authentifizierung](https://docs.djangoproject.com/en/5.2/topics/auth/default/),
[SQLite-Transaktionen](https://docs.djangoproject.com/en/5.2/ref/databases/#sqlite-notes),
+3 -1
View File
@@ -35,7 +35,9 @@ Nachgewiesen:
- Bestellung von zwei Personen 2 + 1 ergibt **Gesamt 3**, Aufteilung 2/1; Spule/Refill getrennt.
- Sechs parallele echte HTTP-Zugänge ergeben eine Position mit **Menge 6**.
- Mengenlimits/Unique-Constraints, CSRF, POST-basiertes Löschen, Passwortwechsel und Kontosperre.
- Deaktivierte Varianten bleiben sichtbar, sind nicht neu hinzufügbar; Beispielkatalog idempotent.
- Deaktivierte Varianten bleiben sichtbar und sind nicht neu hinzufügbar; der vollständige
statische Bambu-Lab-EU-Erstkatalog wird pro Datenbank nur einmal importiert. Spätere lokale
Löschungen, Deaktivierungen, Umbenennungen und Ergänzungen werden nicht zurückgesetzt.
- Admin kann Konten/Katalog verwalten, aber keine privaten Daten-/Profilseiten oder privaten User-Feldfilter nutzen.
- WhiteNoise liefert CSS bei DEBUG=0 tatsächlich aus; Gunicorn-Neustart erhält Daten und Sitzungen.
- Bootstrap-Test kopiert **nur die Startdatei** in einen persistenten Test-App-Ordner. Keine
+387
View File
@@ -0,0 +1,387 @@
"""Statischer Bambu-Lab-EU-Filamentkatalog.
Quelle: öffentlicher Produktfeed des offiziellen Bambu Lab EU Store.
Datenstand: 14. November 2026. Temporäre Lagerverfügbarkeit wird bewusst ignoriert.
"""
BAMBU_LAB_CATALOG_SOURCE = "https://eu.store.bambulab.com/collections/bambu-lab-3d-printer-filament"
BAMBU_LAB_CATALOG_DATE = "2026-11-14"
# Produktart -> (Farbe, Hersteller-Farbcode, Nettogewicht in g, Spulenausführungen)
BAMBU_LAB_CATALOG = (
(
"PLA Translucent",
(
("Teal", "13612", 1000, ("spool",)),
("Blue", "13611", 1000, ("spool",)),
("Purple", "13710", 1000, ("spool",)),
("Orange", "13301", 1000, ("spool",)),
("Red", "13210", 1000, ("spool",)),
("Light Jade", "13510", 1000, ("spool",)),
("Mellow Yellow", "13410", 1000, ("spool",)),
("Cherry Pink", "13211", 1000, ("spool",)),
("Ice Blue", "13610", 1000, ("spool",)),
("Lavender", "13711", 1000, ("spool",)),
),
),
(
"PLA Basic",
(
("Jade White", "10100", 1000, ("refill", "spool")),
("Beige", "10201", 1000, ("refill",)),
("Light Gray", "10104", 1000, ("refill",)),
("Yellow", "10400", 1000, ("refill",)),
("Sunflower Yellow", "10402", 1000, ("refill", "spool")),
("Gold", "10401", 1000, ("refill",)),
("Pumpkin Orange", "10301", 1000, ("refill", "spool")),
("Orange", "10300", 1000, ("refill",)),
("Bright Green", "10503", 1000, ("refill",)),
("Bambu Green", "10501", 1000, ("refill", "spool")),
("Mistletoe Green", "10502", 1000, ("refill", "spool")),
("Pink", "10203", 1000, ("refill",)),
("Hot Pink", "10204", 1000, ("refill", "spool")),
("Magenta", "10202", 1000, ("refill",)),
("Red", "10200", 1000, ("refill", "spool")),
("Maroon Red", "10205", 1000, ("refill",)),
("Purple", "10700", 1000, ("refill",)),
("Indigo Purple", "10701", 1000, ("refill", "spool")),
("Turquoise", "10605", 1000, ("refill",)),
("Cyan", "10603", 1000, ("refill", "spool")),
("Cobalt Blue", "10604", 1000, ("refill",)),
("Blue", "10601", 1000, ("refill", "spool")),
("Brown", "10800", 1000, ("refill",)),
("Cocoa Brown", "10802", 1000, ("refill", "spool")),
("Bronze", "10801", 1000, ("refill",)),
("Gray", "10103", 1000, ("refill", "spool")),
("Silver", "10102", 1000, ("refill",)),
("Blue Grey", "10602", 1000, ("refill",)),
("Dark Gray", "10105", 1000, ("refill",)),
("Black", "10101", 1000, ("refill", "spool")),
),
),
(
"PLA Matte",
(
("Elfenbeinweiß", "11100", 1000, ("refill", "spool")),
("Matte Latte Brown", "11800", 1000, ("refill",)),
("Matte Ash Grey", "11102", 1000, ("refill", "spool")),
("Matte Desert Tan", "11401", 1000, ("refill",)),
("Matte Lemon Yellow", "11400", 1000, ("refill",)),
("Matte Mandarin Orange", "11300", 1000, ("refill", "spool")),
("Matte Sakura Pink", "11201", 1000, ("refill",)),
("Matte Grass Green", "11500", 1000, ("refill",)),
("Eisblau", "11601", 1000, ("refill",)),
("Matte Marine Blue", "11600", 1000, ("refill", "spool")),
("Matte Lilac purple", "11700", 1000, ("refill",)),
("Scharlachrot", "11200", 1000, ("refill", "spool")),
("Matte Dark Red", "11202", 1000, ("refill",)),
("Matte Dark Brown", "11801", 1000, ("refill",)),
("Matte Dark Green", "11501", 1000, ("refill",)),
("Matte Dark Blue", "11602", 1000, ("refill",)),
("Kohleschwarz", "11101", 1000, ("refill", "spool")),
("Matte Bone White", "11103", 1000, ("refill",)),
("Matte Plum", "11204", 1000, ("refill",)),
("Matte Sky Blue", "11603", 1000, ("refill",)),
("Matte Apple Green", "11502", 1000, ("refill",)),
("Matte Dark Chocolate", "11802", 1000, ("refill",)),
("Matte Caramel", "11803", 1000, ("refill",)),
("Matte Terracotta", "11203", 1000, ("refill",)),
("Matte Nardo Gray", "11104", 1000, ("refill",)),
),
),
(
"PLA Silk+",
(
("Titan Gray", "13108", 1000, ("spool",)),
("Rose Gold", "13206", 1000, ("spool",)),
("Baby Blue", "13603", 1000, ("spool",)),
("Champagne", "13404", 1000, ("spool",)),
("Mint", "13507", 1000, ("spool",)),
("Candy Red", "13205", 1000, ("spool",)),
("Candy Green", "13506", 1000, ("spool",)),
("Blue", "13604", 1000, ("spool",)),
("Purple", "13702", 1000, ("spool",)),
("Pink", "13207", 1000, ("spool",)),
("White", "13110", 1000, ("spool",)),
("Silver", "13109", 1000, ("spool",)),
("Gold", "13405", 1000, ("spool",)),
),
),
(
"PETG HF",
(
("Red", "33200", 1000, ("refill", "spool")),
("Blue", "33600", 1000, ("refill", "spool")),
("Black", "33102", 1000, ("refill", "spool")),
("White", "33100", 1000, ("refill", "spool")),
("Gray", "33101", 1000, ("refill", "spool")),
("Yellow", "33400", 1000, ("refill",)),
("Orange", "33300", 1000, ("refill",)),
("Green", "33500", 1000, ("refill",)),
("Forest Green", "33502", 1000, ("refill",)),
("Peanut Brown", "33801", 1000, ("refill",)),
("Dark Gray", "33103", 1000, ("refill",)),
("Cream", "33401", 1000, ("refill",)),
("Lime Green", "33501", 1000, ("refill",)),
("Lake Blue", "33601", 1000, ("refill",)),
),
),
(
"PETG Translucent",
(
("Translucent Teal", "32501", 1000, ("refill", "spool")),
("Translucent Light Blue", "32600", 1000, ("refill", "spool")),
("Clear", "32101", 1000, ("refill", "spool")),
("Translucent Pink", "32200", 1000, ("refill",)),
("Translucent Olive", "32500", 1000, ("refill",)),
("Translucent Orange", "32300", 1000, ("refill",)),
("Translucent Purple", "32700", 1000, ("refill",)),
("Translucent Brown", "32800", 1000, ("refill",)),
("Translucent Gray", "32100", 1000, ("refill",)),
),
),
(
"ABS",
(
("ABS Silver", "40102", 1000, ("refill", "spool")),
("ABS Black", "40101", 1000, ("refill", "spool")),
("ABS White", "40100", 1000, ("refill", "spool")),
("ABS Red", "40200", 1000, ("refill",)),
("ABS Bambu Green", "40500", 1000, ("refill",)),
("ABS Orange", "40300", 1000, ("refill",)),
("ABS Navy Blue", "40602", 1000, ("refill",)),
("ABS Tangerine Yellow", "40402", 1000, ("refill",)),
("ABS Blue", "40600", 1000, ("refill",)),
("ABS Olive", "40502", 1000, ("refill",)),
("ABS Azure", "40601", 1000, ("refill",)),
),
),
("Support for PLA (New Version)", (("White", "65104", 500, ("spool",)),)),
(
"TPU 90A",
(
("Frozen", "51900", 1000, ("spool",)),
("Blaze", "51901", 1000, ("spool",)),
("Black", "51103", 1000, ("spool",)),
("White", "51105", 1000, ("spool",)),
),
),
(
"TPU 85A",
(
("Light Cyan", "51500", 1000, ("spool",)),
("Neon Orange", "51305", 1000, ("spool",)),
),
),
(
"PLA Silk Dual Color",
(
("Velvet Eclipse (Black-Red)", "", 1000, ("spool",)),
("Neon City (Blue-Magenta)", "", 1000, ("spool",)),
("Midnight Blaze (Blue-Red)", "", 1000, ("spool",)),
("Gilded Rose (Pink-Gold)", "", 1000, ("spool",)),
("Blue Hawaii (Blue-Green)", "", 1000, ("spool",)),
),
),
(
"PLA Basic Gradient",
(
("Cotton Candy Cloud", "10907", 1000, ("spool",)),
("Blueberry Bubblegum", "10905", 1000, ("spool",)),
("Pink Citrus", "10903", 1000, ("spool",)),
("Mint Lime", "10904", 1000, ("spool",)),
("Dusk Glare", "10906", 1000, ("spool",)),
("Ocean to Meadow", "10902", 1000, ("spool",)),
("Arctic Whisper", "10900", 1000, ("spool",)),
("Solar Breeze", "10901", 1000, ("spool",)),
),
),
(
"PLA Glow",
(
("Glow Orange", "15300", 1000, ("spool",)),
("Glow Yellow", "15400", 1000, ("spool",)),
("Glow Green", "15500", 1000, ("spool",)),
("Glow Pink", "15200", 1000, ("spool",)),
("Glow Blue", "15600", 1000, ("spool",)),
),
),
(
"PLA Galaxy",
(
("Purple", "13602", 1000, ("spool",)),
("Green", "13503", 1000, ("spool",)),
("Nebulae", "13504", 1000, ("spool",)),
("Brown", "13203", 1000, ("spool",)),
),
),
(
"PLA Wood",
(
("Classic Birch", "13505", 1000, ("spool",)),
("Black Walnut", "13107", 1000, ("spool",)),
("Rosewood", "13204", 1000, ("spool",)),
("Clay Brown", "13801", 1000, ("spool",)),
("White Oak", "13106", 1000, ("spool",)),
("Ochre Yellow", "13403", 1000, ("spool",)),
),
),
(
"PLA Metal",
(
("Cobalt Blue Metallic", "13600", 1000, ("spool",)),
("Oxide Green Metallic", "13500", 1000, ("spool",)),
("Iridium Gold Metallic", "13400", 1000, ("spool",)),
("Copper Brown Metallic", "13800", 1000, ("spool",)),
("Iron Gray Metallic", "13100", 1000, ("spool",)),
),
),
(
"ASA",
(
("Green", "45500", 1000, ("spool",)),
("Red", "45200", 1000, ("spool",)),
("Blue", "45600", 1000, ("spool",)),
("White", "45100", 1000, ("spool",)),
("Gray", "45102", 1000, ("spool",)),
("Black", "45101", 1000, ("spool",)),
),
),
(
"PLA Aero",
(
("White", "14102", 1000, ("spool",)),
("Gray", "14104", 1000, ("spool",)),
),
),
(
"PLA Sparkle",
(
("Alpine Green Sparkle", "13501", 1000, ("spool",)),
("Slate Gray Sparkle", "13102", 1000, ("spool",)),
("Royal Purple Sparkle", "13700", 1000, ("spool",)),
("Crimson Red Sparkle", "13200", 1000, ("spool",)),
("Onyx Black Sparkle", "13101", 1000, ("spool",)),
("Classic Gold Sparkle", "13402", 1000, ("spool",)),
),
),
(
"PLA Marble",
(
("Red Granite", "13201", 1000, ("spool",)),
("White Marble", "13103", 1000, ("spool",)),
),
),
(
"PLA-CF",
(
("Matcha Green", "14500", 1000, ("spool",)),
("Burgundy Red", "14200", 1000, ("spool",)),
("Jeans Blue", "14600", 1000, ("spool",)),
("Lava Gray", "14101", 1000, ("spool", "refill")),
("Black", "14100", 1000, ("spool", "refill")),
("Royal Blue", "14601", 1000, ("spool",)),
("Iris Purple", "14700", 1000, ("spool",)),
),
),
(
"PETG-CF",
(
("Violet Purple", "31700", 1000, ("spool",)),
("Malachite Green", "31500", 1000, ("spool",)),
("Indigo Blue", "31600", 1000, ("spool",)),
("Black", "31100", 1000, ("spool", "refill")),
("Titan Gray", "31101", 1000, ("spool",)),
("Brick Red", "31200", 1000, ("spool",)),
),
),
("ASA Aero", (("White", "46100", 1000, ("spool",)),)),
(
"PC",
(
("Transparent", "60103", 1000, ("spool",)),
("Clear Black", "60102", 1000, ("spool",)),
("Black", "60101", 1000, ("spool",)),
("White", "60100", 1000, ("spool",)),
),
),
(
"PC FR",
(
("Black", "63100", 1000, ("spool",)),
("White", "63101", 1000, ("spool",)),
("Gray", "63102", 1000, ("spool",)),
),
),
(
"TPU for AMS",
(
("Blue", "53600", 1000, ("spool",)),
("Gray", "53102", 1000, ("spool",)),
("Black", "53101", 1000, ("spool",)),
("Yellow", "53400", 1000, ("spool",)),
("Red", "53200", 1000, ("spool",)),
("Neon Green", "53500", 1000, ("spool",)),
("White", "53100", 1000, ("spool",)),
),
),
(
"TPU 95A HF",
(
("White", "51102", 1000, ("spool",)),
("Gray", "51101", 1000, ("spool",)),
("Yellow", "51400", 1000, ("spool",)),
("Blue", "51600", 1000, ("spool",)),
("Red", "51200", 1000, ("spool",)),
("Black", "51100", 1000, ("spool",)),
),
),
(
"ABS-GF",
(
("Orange", "41300", 1000, ("spool",)),
("Green", "41500", 1000, ("spool",)),
("Red", "41200", 1000, ("spool",)),
("Yellow", "41400", 1000, ("spool",)),
("Blue", "41600", 1000, ("spool",)),
("White", "41100", 1000, ("spool",)),
("Gray", "41102", 1000, ("spool",)),
("Black", "41101", 1000, ("spool",)),
),
),
(
"PA6-GF",
(
("Blue", "72600", 1000, ("spool",)),
("Orange", "72200", 1000, ("spool",)),
("Yellow", "72400", 1000, ("spool",)),
("Lime", "72500", 1000, ("spool",)),
("Brown", "72800", 1000, ("spool",)),
("White", "72102", 1000, ("spool",)),
("Gray", "72103", 1000, ("spool",)),
("Black", "72104", 1000, ("spool",)),
),
),
("PAHT-CF (500 g)", (("Black", "70100", 500, ("spool",)),)),
("PAHT-CF (1 kg)", (("Black", "70100", 1000, ("spool",)),)),
("PA6-CF (500 g)", (("Black", "72100", 500, ("spool",)),)),
("PA6-CF (1 kg)", (("Black", "72100", 1000, ("spool",)),)),
("PET-CF (500 g)", (("Black", "71100", 500, ("spool",)),)),
("PET-CF (1 kg)", (("Black", "71100", 1000, ("spool",)),)),
("ASA-CF", (("Black", "46101", 1000, ("spool",)),)),
("PPA-CF", (("Black", "73100", 750, ("spool",)),)),
("PPS-CF", (("Black", "76100", 750, ("spool",)),)),
(
"Support for PLA/PETG",
(
("Black", "65103", 500, ("spool",)),
("Nature", "65102", 500, ("spool",)),
),
),
("PVA", (("Clear", "66400", 500, ("spool",)),)),
("Support for PA/PET", (("Green", "65500", 500, ("spool",)),)),
("Support for ABS", (("White", "66100", 500, ("spool",)),)),
)
BAMBU_LAB_PRODUCT_COUNT = 42
BAMBU_LAB_VARIANT_COUNT = 265
+36 -25
View File
@@ -3,38 +3,49 @@ from decimal import Decimal
from django.core.management.base import BaseCommand
from django.db import transaction
from filament.models import Color, Manufacturer, ProductType, Variant
from filament.bambu_catalog import BAMBU_LAB_CATALOG, BAMBU_LAB_VARIANT_COUNT
from filament.models import CatalogBootstrap, Color, Manufacturer, ProductType, Variant
BAMBU_LAB_BOOTSTRAP_KEY = "bambu-lab-eu-initial-catalog"
class Command(BaseCommand):
help = "Ergänzt acht PLA-Matte-Beispielvarianten; überschreibt keine bestehenden Daten."
help = "Importiert den Bambu-Lab-EU-Erstkatalog genau einmal pro Datenbank."
@transaction.atomic
def handle(self, *args, **options):
manufacturer, _ = Manufacturer.objects.get_or_create(name="Bambu Lab")
product, _ = ProductType.objects.get_or_create(manufacturer=manufacturer, name="PLA Matte")
created = 0
# Source: https://eu.store.bambulab.com/products/pla-matte (see README).
for name, code in [
("Elfenbeinweiß", "11100"),
("Kohleschwarz", "11101"),
("Scharlachrot", "11200"),
("Eisblau", "11601"),
]:
color, _ = Color.objects.get_or_create(name=name)
for spool_type in Variant.SpoolType.values:
_, new = Variant.objects.get_or_create(
product_type=product,
color=color,
spool_type=spool_type,
defaults={
"manufacturer_color_code": code,
"net_weight_g": 1000,
"diameter_mm": Decimal("1.75"),
},
_, should_import = CatalogBootstrap.objects.get_or_create(key=BAMBU_LAB_BOOTSTRAP_KEY)
if not should_import:
if options["verbosity"]:
self.stdout.write(
"Bambu-Lab-Erstkatalog wurde bereits importiert; Benutzerdaten bleiben unverändert."
)
created += new
return
manufacturer, _ = Manufacturer.objects.get_or_create(name="Bambu Lab")
created = 0
for product_name, catalog_variants in BAMBU_LAB_CATALOG:
product, _ = ProductType.objects.get_or_create(
manufacturer=manufacturer, name=product_name
)
for color_name, code, net_weight_g, spool_types in catalog_variants:
color, _ = Color.objects.get_or_create(name=color_name)
for spool_type in spool_types:
_, new = Variant.objects.get_or_create(
product_type=product,
color=color,
spool_type=spool_type,
defaults={
"manufacturer_color_code": code,
"net_weight_g": net_weight_g,
"diameter_mm": Decimal("1.75"),
},
)
created += new
if options["verbosity"]:
self.stdout.write(
self.style.SUCCESS(f"Beispielkatalog bereit: {created} Varianten ergänzt.")
self.style.SUCCESS(
f"Bambu-Lab-Erstkatalog importiert: {created} Varianten ergänzt; "
f"{BAMBU_LAB_VARIANT_COUNT} Varianten im Datenstand."
)
)
@@ -0,0 +1,23 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("filament", "0003_printer"),
]
operations = [
migrations.CreateModel(
name="CatalogBootstrap",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
("key", models.CharField(max_length=100, unique=True)),
("applied_at", models.DateTimeField(auto_now_add=True)),
],
),
]
+7
View File
@@ -156,3 +156,10 @@ class Printer(models.Model):
def __str__(self):
base = f"{self.manufacturer} {self.model}"
return f"{base} · {self.name}" if self.name else base
class CatalogBootstrap(models.Model):
"""Internal marker: bundled starter catalogs are imported only once."""
key = models.CharField(max_length=100, unique=True)
applied_at = models.DateTimeField(auto_now_add=True)
+218 -180
View File
@@ -1,13 +1,17 @@
/* Self-hosted, dependency-free UI. */
:root {
color-scheme: light;
--ink: #172d2c;
--muted: #667b78;
--green: #176d59;
--light: #edf5f1;
--line: #e0e8e3;
--paper: #f6f8f5;
--danger: #a63c34;
--ink: #172833;
--muted: #4d6069;
--green: #095d50;
--light: #dff2e9;
--line: #27455424;
--paper: #edf3f5;
--danger: #a12f40;
--surface: rgb(255 255 255 / 72%);
--surface-solid: #f8fbfc;
--radius: 20px;
--shadow: 0 14px 36px rgb(28 62 83 / 8%), inset 0 1px 0 rgb(255 255 255 / 85%);
font-family:
Inter,
ui-sans-serif,
@@ -24,6 +28,11 @@
}
body {
margin: 0;
background:
radial-gradient(ellipse at 88% 2%, #d9dffb, transparent 55%),
radial-gradient(ellipse at 24% 5%, #d3efe4, transparent 52%), var(--paper);
background-repeat: no-repeat;
background-size: 100% 56rem;
}
a {
color: var(--green);
@@ -47,38 +56,62 @@ button {
cursor: pointer;
}
:focus-visible {
outline: 3px solid #e9ab36;
outline: 3px solid #2864ab;
outline-offset: 3px;
}
.shell {
display: flex;
min-height: 100vh;
display: grid;
grid-template-columns: 238px minmax(0, 1fr);
align-items: start;
gap: clamp(24px, 3.5vw, 54px);
min-height: 100svh;
max-width: 1640px;
margin-inline: auto;
padding: clamp(16px, 2.3vw, 34px);
}
.sidebar {
width: 244px;
background: #fff;
border-right: 1px solid var(--line);
padding: 36px 24px 24px;
position: sticky;
top: 24px;
max-height: calc(100vh - 48px);
overflow: auto;
padding: 22px 16px 16px;
display: flex;
flex-direction: column;
flex-shrink: 0;
background: var(--surface-solid);
border: 1px solid rgb(255 255 255 / 90%);
border-radius: var(--radius);
box-shadow: var(--shadow);
}
@supports (backdrop-filter: blur(16px)) {
.sidebar,
.login-card {
background: var(--surface);
backdrop-filter: blur(16px);
}
}
.brand {
display: flex;
align-items: center;
gap: 12px;
font-size: 27px;
font-size: 24px;
font-weight: 800;
color: var(--ink);
line-height: 1.1;
margin-bottom: 48px;
margin: 0 6px 24px;
}
.brand:hover {
text-decoration: none;
}
.brand-icon {
font-size: 40px;
color: var(--green);
display: grid;
place-items: center;
flex: 0 0 42px;
height: 42px;
border-radius: 13px;
background: linear-gradient(145deg, #197f6b, #134b50);
box-shadow: 0 5px 12px rgb(12 88 76 / 23%);
font-size: 26px;
color: #fff;
}
.brand-small {
display: block;
@@ -91,37 +124,57 @@ button {
font-size: 10px;
letter-spacing: 1.6px;
font-weight: 700;
color: #899a93;
margin: 24px 12px 12px;
color: var(--muted);
margin: 20px 10px 7px;
}
nav > a {
display: flex;
gap: 12px;
gap: 9px;
align-items: center;
padding: 13px 12px;
color: #5d716c;
font-size: 14px;
border-radius: 8px;
padding: 9px 10px;
color: var(--muted);
font-size: 13px;
font-weight: 550;
border-radius: 11px;
margin: 3px 0;
}
nav > a[aria-current] {
background: var(--light);
background: linear-gradient(120deg, #d4ede2, #e6f3ee);
color: var(--green);
font-weight: 650;
box-shadow: inset 0 0 0 1px #16756026;
font-weight: 700;
}
nav > a:hover {
background: var(--paper);
nav > a:hover,
.profile-link:hover,
.profile-link[aria-current] {
background-color: #145e5710;
text-decoration: none;
}
.nav-icon {
display: grid;
flex: 0 0 26px;
width: 26px;
height: 26px;
place-items: center;
border-radius: 8px;
background: rgb(255 255 255 / 68%);
color: var(--green);
font-size: 15px;
}
.sidebar-bottom {
margin-top: auto;
padding-top: 40px;
margin-top: 24px;
padding-top: 12px;
border-top: 1px solid var(--line);
}
.profile-link {
display: flex;
gap: 12px;
align-items: center;
color: var(--ink);
padding: 7px;
min-width: 0;
border-radius: 11px;
overflow-wrap: anywhere;
}
.profile-link small,
td small {
@@ -131,10 +184,12 @@ td small {
color: var(--muted);
}
.avatar {
background: #e6efe8;
flex-shrink: 0;
background: #d7eee3;
color: var(--green);
width: 38px;
height: 38px;
border-radius: 50%;
border-radius: 12px;
display: grid;
place-items: center;
font-size: 15px;
@@ -147,48 +202,37 @@ td small {
border: 0;
background: none;
color: var(--muted);
padding: 14px 0 0 50px;
padding: 10px 12px;
margin-left: 44px;
border-radius: 9px;
font-size: 12px;
}
.logout:hover {
background: #145e5710;
color: var(--ink);
}
.main-wrap {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.topbar {
height: 75px;
border-bottom: 1px solid var(--line);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 46px;
color: var(--muted);
font-size: 12px;
background: #ffffff80;
}
.badge {
display: inline-block;
background: #edf2ee;
background: #11645712;
padding: 5px 10px;
border-radius: 5px;
color: #587067;
border-radius: 999px;
color: #305e54;
font-size: 11px;
font-weight: 600;
white-space: nowrap;
}
main {
padding: 42px 46px;
flex: 1;
max-width: 1550px;
width: 100%;
padding: clamp(16px, 3vw, 42px) 0 36px;
}
.page-heading {
display: flex;
justify-content: space-between;
align-items: center;
gap: 20px;
margin-bottom: 30px;
margin-bottom: clamp(22px, 3vw, 36px);
}
.eyebrow {
letter-spacing: 2px;
@@ -198,13 +242,14 @@ main {
margin: 0 0 12px;
}
h1 {
font-size: 30px;
letter-spacing: -1px;
margin: 0 0 12px;
font-weight: 730;
font-size: clamp(1.85rem, 3.4vw, 3rem);
letter-spacing: -0.045em;
line-height: 1.08;
margin: 0 0 10px;
font-weight: 760;
}
h2 {
font-size: 15px;
font-size: 17px;
margin: 0;
}
h3 {
@@ -215,7 +260,7 @@ p {
line-height: 1.65;
}
.muted {
font-size: 13px;
font-size: 14px;
color: var(--muted);
margin: 0;
}
@@ -224,21 +269,25 @@ p {
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 18px;
border-radius: 7px;
background: var(--green);
min-height: 44px;
padding: 10px 16px;
border-radius: 11px;
background: linear-gradient(145deg, #117765, #09584e);
box-shadow: 0 4px 12px rgb(10 87 71 / 20%);
color: #fff;
border: 1px solid var(--green);
font-size: 12px;
font-weight: 650;
white-space: nowrap;
font-size: 13px;
font-weight: 700;
text-align: center;
flex-shrink: 0;
}
.button:hover {
background: #105542;
text-decoration: none;
}
.secondary {
background: white;
background: var(--surface);
box-shadow: none;
color: var(--green);
border-color: var(--line);
}
@@ -249,17 +298,25 @@ p {
background: var(--danger);
border-color: var(--danger);
}
.danger:hover {
background: #812232;
}
.stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 18px;
margin-bottom: 28px;
}
.stat,
.panel,
.login-card {
border: 1px solid rgb(255 255 255 / 95%);
border-radius: var(--radius);
background: var(--surface);
box-shadow: var(--shadow);
}
.stat {
padding: 22px 24px;
border: 1px solid var(--line);
border-radius: 10px;
background: #fff;
padding: clamp(16px, 2vw, 25px);
}
.stat > span {
font-size: 12px;
@@ -267,26 +324,24 @@ p {
}
.stat strong {
display: block;
font-size: 33px;
letter-spacing: -1px;
margin: 10px 0;
font-size: clamp(1.75rem, 3vw, 2.6rem);
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: -0.04em;
margin: 12px 0 8px;
}
.stat small {
font-size: 11px;
color: #84958c;
color: var(--muted);
}
.privacy {
background: #eaf2ec;
border-color: #d7e7dc;
background: linear-gradient(125deg, #e8f8ee, #def2eaad);
}
.privacy strong {
font-size: 29px;
font-size: clamp(1.55rem, 2.6vw, 2.1rem);
color: var(--green);
}
.panel {
border: 1px solid var(--line);
border-radius: 10px;
background: #fff;
overflow: hidden;
margin-bottom: 22px;
}
@@ -295,6 +350,7 @@ p {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
border-bottom: 1px solid var(--line);
}
.table-wrap {
@@ -306,20 +362,24 @@ table {
width: 100%;
border-collapse: collapse;
text-align: left;
font-size: 12px;
font-size: 13px;
}
th {
padding: 14px 22px;
background: #fafcf9;
color: #7c8f84;
font-size: 10px;
background: #e8eff487;
color: var(--muted);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
font-weight: 650;
}
td {
padding: 20px 22px;
border-top: 1px solid #eef2ed;
padding: 17px 22px;
border-top: 1px solid var(--line);
}
tbody tr:hover,
tbody tr:focus-within {
background: #dcefe870;
}
td.quantity {
font-size: 18px;
@@ -328,7 +388,7 @@ td.quantity {
}
.actions {
white-space: nowrap;
font-size: 11px;
font-size: 12px;
}
.actions a + a {
margin-left: 14px;
@@ -349,29 +409,26 @@ td.quantity {
margin: 12px 0 24px;
}
.empty-icon {
font-size: 50px;
color: #9fbdac;
display: inline-grid;
place-items: center;
width: 56px;
height: 56px;
border-radius: 18px;
background: var(--light);
color: var(--green);
font-size: 31px;
}
.hint {
font-size: 11px;
font-size: 12px;
color: var(--muted);
}
footer {
display: flex;
justify-content: space-between;
gap: 16px;
font-size: 10px;
color: #93a096;
border-top: 1px solid var(--line);
padding: 22px 46px;
}
.form-panel {
padding: 28px;
max-width: 850px;
}
.form-grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 18px;
}
.field {
@@ -382,7 +439,7 @@ footer {
}
.field label {
display: block;
font-size: 12px;
font-size: 13px;
font-weight: 650;
margin-bottom: 8px;
}
@@ -390,11 +447,11 @@ footer {
.field select {
width: 100%;
padding: 11px 12px;
border: 1px solid #cddbd2;
border-radius: 6px;
background: #fff;
border: 1px solid #7c979e;
border-radius: 10px;
background: rgb(255 255 255 / 84%);
color: var(--ink);
min-height: 42px;
min-height: 44px;
}
.field input:disabled {
background: var(--paper);
@@ -427,19 +484,34 @@ footer {
background: #e1f0e6;
color: #24613f;
font-size: 13px;
border-radius: 7px;
border-radius: 12px;
margin-bottom: 24px;
}
.shell--guest {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto 1fr;
gap: 0;
}
.shell--guest .sidebar {
position: static;
justify-self: start;
padding: 10px 14px;
}
.shell--guest .brand {
margin: 0;
}
.shell--guest main {
display: grid;
align-content: center;
min-height: min(68svh, 45rem);
}
.login-card {
max-width: 430px;
padding: 36px;
background: white;
border: 1px solid var(--line);
border-radius: 12px;
margin: 30px auto;
width: min(100%, 440px);
padding: clamp(22px, 4vw, 42px);
margin: 0 auto;
}
.login-card h1 {
font-size: 27px;
font-size: clamp(1.85rem, 4vw, 2.4rem);
}
.login-card form {
margin-top: 28px;
@@ -473,13 +545,13 @@ footer {
}
.person {
background: var(--paper);
border-radius: 4px;
border-radius: 8px;
padding: 5px 8px;
font-size: 11px;
}
.cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
gap: 18px;
}
.printer-card {
@@ -495,43 +567,23 @@ footer {
.notice {
padding: 20px 24px;
background: var(--light);
border-radius: 8px;
border-radius: 12px;
font-size: 12px;
color: var(--green);
margin-bottom: 24px;
}
@media (min-width: 1800px) {
main {
margin: 0 auto;
}
}
@media (max-width: 1100px) {
.sidebar {
width: 210px;
padding: 28px 16px;
}
main {
padding: 30px 24px;
}
.topbar,
footer {
padding-left: 24px;
padding-right: 24px;
.shell:not(.shell--guest) {
grid-template-columns: 204px minmax(0, 1fr);
}
.page-heading {
align-items: flex-start;
}
.page-heading > .button {
margin-top: 24px;
}
td,
th {
padding-left: 15px;
padding-right: 15px;
}
.stat {
padding: 20px;
}
.stats {
gap: 12px;
}
@@ -539,19 +591,17 @@ footer {
@media (max-width: 760px) {
.shell {
display: block;
padding: 12px;
}
.sidebar {
width: 100%;
padding: 18px 20px;
border-right: 0;
border-bottom: 1px solid var(--line);
position: static;
max-height: none;
overflow: visible;
padding: 14px;
}
.brand {
font-size: 23px;
margin-bottom: 15px;
}
.brand-icon {
font-size: 32px;
margin-bottom: 12px;
}
.brand-small {
font-size: 8px;
@@ -561,18 +611,21 @@ footer {
display: none;
}
nav {
display: flex;
flex-wrap: wrap;
gap: 4px;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 3px 5px;
}
nav > a {
padding: 10px;
font-size: 11px;
gap: 5px;
padding: 6px;
min-height: 44px;
margin: 0;
font-size: 12px;
gap: 6px;
overflow-wrap: anywhere;
}
.sidebar-bottom {
padding: 14px 0 0;
margin: 0;
padding: 7px 0 0;
margin-top: 8px;
display: flex;
justify-content: space-between;
align-items: center;
@@ -585,14 +638,11 @@ footer {
height: 28px;
}
.logout {
padding: 0;
}
.topbar {
height: 48px;
padding: 0 20px;
margin-left: 0;
min-height: 44px;
}
main {
padding: 28px 18px;
padding: 26px 2px 18px;
}
.page-heading {
display: block;
@@ -601,11 +651,8 @@ footer {
.page-heading > .button {
margin-top: 16px;
}
h1 {
font-size: 26px;
}
.stats {
grid-template-columns: 1fr 1fr;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.privacy {
@@ -641,19 +688,10 @@ footer {
.form-actions {
flex-wrap: wrap;
}
.login-card {
padding: 26px;
margin: 12px auto;
.shell--guest .sidebar {
display: inline-flex;
}
.empty {
padding: 40px 20px;
}
footer {
padding: 18px;
display: block;
}
footer span {
display: block;
margin-top: 6px;
}
}
+49 -9
View File
@@ -1,7 +1,16 @@
from django.core.management import call_command, get_commands
from filament.bambu_catalog import BAMBU_LAB_PRODUCT_COUNT, BAMBU_LAB_VARIANT_COUNT
from filament.forms import VariantSelectionForm
from filament.models import Color, InventoryItem, Manufacturer, OrderItem, ProductType, Variant
from filament.models import (
CatalogBootstrap,
Color,
InventoryItem,
Manufacturer,
OrderItem,
ProductType,
Variant,
)
from .base import CatalogTestCase
@@ -73,15 +82,46 @@ class CatalogTests(CatalogTestCase):
dict(VariantSelectionForm(selection=self.selection()).fields["spool_type"].choices),
)
def test_example_catalog_is_idempotent_and_does_not_reactivate_variants(self):
def test_bambu_catalog_is_complete_one_time_bootstrap(self):
self.assertIn("seed_catalog", get_commands())
call_command("seed_catalog", verbosity=0)
self.assertEqual(
ProductType.objects.filter(manufacturer__name="Bambu Lab").count(),
BAMBU_LAB_PRODUCT_COUNT,
)
self.assertEqual(Variant.objects.count(), BAMBU_LAB_VARIANT_COUNT)
for product, color, code, spool_type, weight in (
("PLA Basic", "Jade White", "10100", "refill", 1000),
("PLA Translucent", "Teal", "13612", "spool", 1000),
("PAHT-CF (500 g)", "Black", "70100", "spool", 500),
("PAHT-CF (1 kg)", "Black", "70100", "spool", 1000),
("Support for PLA/PETG", "Nature", "65102", "spool", 500),
):
self.assertTrue(
Variant.objects.filter(
product_type__name=product,
color__name=color,
manufacturer_color_code=code,
spool_type=spool_type,
net_weight_g=weight,
diameter_mm="1.75",
).exists(),
(product, color, spool_type),
)
self.assertFalse(ProductType.objects.filter(name__icontains="bundle").exists())
count = Variant.objects.count()
v = Variant.objects.filter(manufacturer_color_code="11100").first()
self.assertIsNotNone(v)
v.is_active = False
v.save()
inactive = Variant.objects.filter(manufacturer_color_code="11100").first()
removed = Variant.objects.get(
product_type__name="PLA Translucent",
manufacturer_color_code="13612",
spool_type="spool",
)
inactive.is_active = False
inactive.save()
removed.delete()
call_command("seed_catalog", verbosity=0)
self.assertEqual(Variant.objects.count(), count)
v.refresh_from_db()
self.assertFalse(v.is_active)
self.assertEqual(Variant.objects.count(), count - 1)
inactive.refresh_from_db()
self.assertFalse(inactive.is_active)
self.assertFalse(Variant.objects.filter(pk=removed.pk).exists())
self.assertEqual(CatalogBootstrap.objects.count(), 1)
+17 -18
View File
@@ -10,34 +10,33 @@
</head>
<body>
<a class="skip" href="#main">Zum Inhalt springen</a>
<div class="shell">
<div class="shell{% if not user.is_authenticated %} shell--guest{% endif %}">
<aside class="sidebar">
<a class="brand" href="/"><span class="brand-icon" aria-hidden="true">◉</span><span>Fil-A<span class="brand-small">MANAGEMENT</span></span></a>
{% if user.is_authenticated %}
<p class="nav-label">DEINE WERKSTATT</p>
<nav aria-label="Hauptnavigation">
<a href="/bestand/"
{% if '/bestand/' in request.path %}aria-current="page"{% endif %}>▤ <span>Mein Bestand</span></a>
{% if '/bestand/' in request.path %}aria-current="page"{% endif %}><span class="nav-icon" aria-hidden="true">▤</span><span>Mein Bestand</span></a>
<a href="/drucker/"
{% if '/drucker/' in request.path %}aria-current="page"{% endif %}>▣ <span>Meine Drucker</span></a>
{% if '/drucker/' in request.path %}aria-current="page"{% endif %}><span class="nav-icon" aria-hidden="true">▣</span><span>Meine Drucker</span></a>
<p class="nav-label">GEMEINSAM</p>
<a href="/bestellung/"
{% if '/bestellung/' in request.path %}aria-current="page"{% endif %}>↗ <span>Sammelbestellung</span></a>
{% if '/bestellung/' in request.path %}aria-current="page"{% endif %}><span class="nav-icon" aria-hidden="true">↗</span><span>Sammelbestellung</span></a>
<a href="/katalog/"
{% if '/katalog/' in request.path %}aria-current="page"{% endif %}>◫ <span>Filamentkatalog</span></a>
{% if user.is_superuser %}<a href="/admin/">⚙ <span>Administration</span></a>{% endif %}
{% if '/katalog/' in request.path %}aria-current="page"{% endif %}><span class="nav-icon" aria-hidden="true">◫</span><span>Filamentkatalog</span></a>
{% if user.is_superuser %}<a href="/admin/"><span class="nav-icon" aria-hidden="true">⚙</span><span>Administration</span></a>{% endif %}
</nav>
<div class="sidebar-bottom">{% if user.is_authenticated %}<a class="profile-link" href="/profil/"><span class="avatar">{{ user.username|first|upper }}</span><span><strong>{{ user.username }}</strong><small>Mein Profil</small></span></a>
<form action="{% url 'logout' %}" method="post">{% csrf_token %}<button class="logout" type="submit">Abmelden</button></form>{% else %}<small>Dein Filament. Euer nächstes Projekt.</small>{% endif %}</div>
<div class="sidebar-bottom"><a class="profile-link" href="/profil/"{% if request.path == '/profil/' %} aria-current="page"{% endif %}><span class="avatar" aria-hidden="true">{{ user.username|first|upper }}</span><span><strong>{{ user.username }}</strong><small>Mein Profil</small></span></a>
<form action="{% url 'logout' %}" method="post">{% csrf_token %}<button class="logout" type="submit">Abmelden</button></form></div>
{% endif %}
</aside>
<div class="main-wrap">
<header class="topbar">
<span>Filament, gut organisiert.</span><span class="badge">MVP · v0.1</span>
</header>
<main id="main">{% for message in messages %}<div class="message {{ message.tags }}" role="status">{{ message }}</div>{% endfor %}{% block content %}{% endblock %}</main>
<footer>
Fil-A-Management <span>Privater Bestand. Gemeinsame Möglichkeiten.</span>
</footer>
<div class="main-wrap">
<main id="main">
{% for message in messages %}<div class="message {{ message.tags }}" role="status">{{ message }}</div>{% endfor %}
{% block content %}{% endblock %}
</main>
</div>
</div>
</div>
</body>
</body>
</html>
+3 -1
View File
@@ -171,7 +171,9 @@ class BootstrapTests(unittest.TestCase):
self.assertTrue((ROOT / "start.sh").is_file())
marker = secrets.token_hex(16)
env = clean_environment() | {
"GIT_REPO_URL": f"https://user:{marker}@example.invalid/repo.git"
"GIT_REPO_URL": f"https://user:{marker}@example.invalid/repo.git",
"PUID": str(os.getuid() or 99),
"PGID": str(os.getgid() or 100),
}
result = subprocess.run(
["sh", str(ROOT / "start.sh")], env=env, capture_output=True, text=True, timeout=20
+13 -1
View File
@@ -19,7 +19,7 @@ class RealHTTPTests(unittest.TestCase):
self.alice.login("synthetic-one", self.password)
self.bob.login("synthetic-two", self.password)
def selection(self, quantity=1, spool="spool"):
def selection(self, quantity=1):
# IDs are discovered from actual rendered forms, not guessed from seed ordering.
html = self.alice.get("/bestand/hinzufuegen/")[1]
manufacturer = re.search(r'<option value="(\d+)"', html).group(1)
@@ -34,6 +34,18 @@ class RealHTTPTests(unittest.TestCase):
{"manufacturer": manufacturer, "product_type": product, "action": "filter"},
)[1]
color = re.search(r'<select name="color".*?<option value="(\d+)"', html, re.S).group(1)
html = self.alice.post(
"/bestand/hinzufuegen/",
{
"manufacturer": manufacturer,
"product_type": product,
"color": color,
"action": "filter",
},
)[1]
spool = re.search(r'<select name="spool_type".*?<option value="([^"]+)"', html, re.S).group(
1
)
return {
"manufacturer": manufacturer,
"product_type": product,