Add JAYO and Anycubic filament starter catalogs

This commit is contained in:
Mikei386 committed 2026-11-14 16:26:55 +01:00
1 parent fbb7a5fc49
commit e2ad117685
5 files changed
+6996 -3

No files matched your search

+14 -2
View File
@@ -22,7 +22,7 @@ Keine SPA, keine externen Schriften/Skripte, kein externer Datenbankserver.
- Die Bestellhistorie zeigt die bestellten, eingetroffenen und übergebenen Positionen der Gruppe.
Bestell- und Übergabezeitpunkte werden bei den jeweiligen Statuswechseln gespeichert.
- Deaktivierte Varianten bleiben in vorhandenen Positionen sichtbar, sind nicht neu wählbar.
- Einmalig ladbare Startkataloge für Bambu Lab, SUNLU und eSUN sowie konsistentes
- Einmalig ladbare Startkataloge für Bambu Lab, SUNLU, eSUN, JAYO und Anycubic sowie konsistentes
SQLite-Online-Backup.
Unter „Spule verbraucht“ lässt sich eine Rolle ausbuchen und dieselbe Variante optional in
@@ -163,7 +163,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`: importiert die Startkataloge von Bambu Lab, SUNLU und eSUN jeweils einmalig |
| `SEED_CATALOG` | Beispiel `1`: importiert die mitgelieferten Herstellerkataloge jeweils einmalig |
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.
@@ -336,6 +336,18 @@ Produktbilder und [Herstellerfarbwerte](https://www.esun3d.com/pla-pro-product)
eindeutiger Zuordnung hinterlegt. Die Artikelnummern bleiben ohne verifizierbare Angabe frei
und können im Admin ergänzt werden.
Der [JAYO-Shop](https://store.jayo3d.com/de/collections/filament) liefert 574 Varianten
in 59 Produkt- und Spulenausführungen für Europa. Der Import enthält die angebotenen
Einzelrollen und Refills, auch wenn der Shop dafür eine Mindestabnahme verlangt.
Mehrwegspulen sind als Unterart gekennzeichnet, wenn JAYO das gleiche Filament auch auf
einer anderen Spule listet. Herstellerfarbwerte sind im Feed nicht hinterlegt.
Der [deutsche Anycubic-Shop](https://de.anycubic3d.com/collections/filament) liefert 266
Varianten in 24 Produktarten. Bei gleicher Artikelnummer ergänzt der
[EU-Shop](https://eu.anycubic3d.com/collections/filaments) Farbvorschauen und Produktbilder,
falls diese im deutschen Feed fehlen. Doppelt gelistete Artikel werden einmal importiert.
Beide Datenstände sind vom 14. November 2026.
Die Datenstände werden mit dem Programm ausgeliefert und beim Start nicht aus dem Shop nachgeladen.
Der erste erfolgreiche Import wird je Hersteller in der Datenbank markiert. Spätere Aufrufe überspringen
den Import vollständig, sodass lokale Löschungen, Deaktivierungen, Umbenennungen und Ergänzungen
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+19 -1
View File
@@ -3,11 +3,13 @@ from decimal import Decimal
from django.core.management.base import BaseCommand
from django.db import transaction
from filament.anycubic_catalog import ANYCUBIC_CATALOG
from filament.bambu_catalog import BAMBU_LAB_CATALOG, BAMBU_LAB_VARIANT_COUNT
from filament.bambu_images_0006 import bambu_image_url
from filament.bambu_petg_catalog import BAMBU_PETG_CATALOG
from filament.bambu_swatches_0005 import BAMBU_SWATCHES
from filament.esun_catalog import ESUN_CATALOG
from filament.jayo_catalog import JAYO_CATALOG
from filament.models import CatalogBootstrap, Color, Manufacturer, ProductType, Variant
from filament.sunlu_catalog import SUNLU_CATALOG, SUNLU_IMAGE_BASE
@@ -15,10 +17,12 @@ BAMBU_LAB_BOOTSTRAP_KEY = "bambu-lab-eu-initial-catalog"
BAMBU_PETG_BOOTSTRAP_KEY = "bambu-lab-eu-petg-basic-matte"
SUNLU_BOOTSTRAP_KEY = "sunlu-de-initial-catalog"
ESUN_BOOTSTRAP_KEY = "esun-eu-initial-catalog"
JAYO_BOOTSTRAP_KEY = "jayo-eu-initial-catalog"
ANYCUBIC_BOOTSTRAP_KEY = "anycubic-de-initial-catalog"
class Command(BaseCommand):
help = "Importiert die Erstkataloge von Bambu Lab, SUNLU und eSUN einmalig pro Datenbank."
help = "Importiert die mitgelieferten Herstellerkataloge einmalig pro Datenbank."
def handle(self, *args, **options):
self.seed_bambu(options["verbosity"])
@@ -29,6 +33,16 @@ class Command(BaseCommand):
options["verbosity"], SUNLU_BOOTSTRAP_KEY, "SUNLU", SUNLU_CATALOG, sunlu_image_url
)
self.seed_catalog(options["verbosity"], ESUN_BOOTSTRAP_KEY, "eSUN", ESUN_CATALOG)
self.seed_catalog(
options["verbosity"], JAYO_BOOTSTRAP_KEY, "JAYO", JAYO_CATALOG, shopify_image_url
)
self.seed_catalog(
options["verbosity"],
ANYCUBIC_BOOTSTRAP_KEY,
"Anycubic",
ANYCUBIC_CATALOG,
shopify_image_url,
)
@transaction.atomic
def seed_bambu(self, verbosity):
@@ -107,3 +121,7 @@ class Command(BaseCommand):
def sunlu_image_url(path):
return SUNLU_IMAGE_BASE + path + "?width=144" if path else ""
def shopify_image_url(path):
return "https://cdn.shopify.com/" + path if path else ""
+62
View File
@@ -3,9 +3,11 @@ 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.management.commands.seed_catalog import (
ANYCUBIC_BOOTSTRAP_KEY,
BAMBU_LAB_BOOTSTRAP_KEY,
BAMBU_PETG_BOOTSTRAP_KEY,
ESUN_BOOTSTRAP_KEY,
JAYO_BOOTSTRAP_KEY,
SUNLU_BOOTSTRAP_KEY,
)
from filament.models import (
@@ -431,3 +433,63 @@ class CatalogTests(CatalogTestCase):
refill.delete()
call_command("seed_catalog", verbosity=0)
self.assertFalse(variants.filter(manufacturer_color_code="30106").exists())
def test_jayo_and_anycubic_import_once_for_existing_installations(self):
CatalogBootstrap.objects.bulk_create(
CatalogBootstrap(key=key)
for key in (
BAMBU_LAB_BOOTSTRAP_KEY,
BAMBU_PETG_BOOTSTRAP_KEY,
SUNLU_BOOTSTRAP_KEY,
ESUN_BOOTSTRAP_KEY,
)
)
call_command("seed_catalog", verbosity=0)
for brand, key, count in (
("JAYO", JAYO_BOOTSTRAP_KEY, 574),
("Anycubic", ANYCUBIC_BOOTSTRAP_KEY, 266),
):
self.assertTrue(CatalogBootstrap.objects.filter(key=key).exists())
self.assertEqual(
Variant.objects.filter(product_type__manufacturer__name=brand).count(), count
)
jayo = Variant.objects.filter(product_type__manufacturer__name="JAYO", color__name="Black")
normal = jayo.get(product_type__name="PLA", spool_type="spool")
reusable = jayo.get(product_type__name="PLA (Mehrwegspule)", spool_type="spool")
refill = jayo.get(product_type__name="PLA", spool_type="refill")
self.assertEqual(reusable.net_weight_g, 1100)
self.assertEqual(refill.manufacturer_color_code, "DLZ-EU-JY-PLA-BK-1.1kg-N")
self.assertEqual(jayo.get(product_type__name="PLA (5 kg)").net_weight_g, 5000)
self.assertTrue(refill.image_url.startswith("https://cdn.shopify.com/"))
anycubic = Variant.objects.filter(
product_type__manufacturer__name="Anycubic",
product_type__name="PETG",
color__name="Schwarz",
)
spool = anycubic.get(spool_type="spool")
self.assertEqual(spool.swatch, "#212721")
self.assertEqual(spool.net_weight_g, 1000)
self.assertEqual(anycubic.get(spool_type="refill").manufacturer_color_code, "AHPEBK-A102")
for url, variant in (
("/bestand/hinzufuegen/", refill),
("/bestellung/hinzufuegen/", spool),
):
response = self.client.post(
url, {"action": "lookup", "article_number": variant.manufacturer_color_code}
)
self.assertEqual(response.context["form"].initial, self.selection(variant))
self.assertRedirects(
self.client.post(url, response.context["form"].initial),
url.removesuffix("hinzufuegen/"),
)
normal.delete()
spool.is_active = False
spool.save(update_fields=["is_active"])
call_command("seed_catalog", verbosity=0)
self.assertFalse(jayo.filter(product_type__name="PLA", spool_type="spool").exists())
spool.refresh_from_db()
self.assertFalse(spool.is_active)
self.assertEqual(Variant.objects.filter(product_type__manufacturer=self.maker).count(), 3)