Align the public site with the PRINTFORGE banner for client demos.
CI / test (pull_request) Successful in 38s

Replace orange with cyan/lime/navy, swap the splash for a print animation, make smart-crop optional, and add a prod-safe seed_demo command. Closes #5.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-07 06:05:29 -05:00
co-authored by Cursor
parent 04e75ec7a3
commit 10263e08ff
19 changed files with 34722 additions and 65 deletions
+42
View File
@@ -414,6 +414,8 @@ class ShopPortalTests(TestCase):
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Shop card preview")
self.assertContains(response, 'name="images"')
self.assertContains(response, 'name="smart_crop"')
self.assertContains(response, "Smart crop and background filter")
self.assertContains(response, 'name="stl"')
self.assertContains(response, "Add color")
@@ -512,6 +514,32 @@ class ShopPortalTests(TestCase):
b"".join(fetch.streaming_content), bytes(product.image.data)
)
def test_create_product_skips_smart_crop_when_unchecked(self):
raw = _tiny_png()
upload = SimpleUploadedFile("keep.png", raw, content_type="image/png")
with patch("shop.imaging.cutout_subject") as cut:
response = self.client.post(
reverse("shop_portal:product_new"),
{
"name": "Raw photo toy",
"sku": "RAW-1",
"price": "10.00",
"stock_qty": "1",
"fulfillment": "stocked",
"track_inventory": "on",
"smart_crop": "off",
"images": upload,
},
)
self.assertEqual(response.status_code, 302)
cut.assert_not_called()
product = Product.objects.get(sku="RAW-1")
stored = product.images.get().file
self.assertEqual(bytes(stored.data), raw)
self.assertEqual(stored.filename, "keep.png")
framed = Image.open(BytesIO(bytes(stored.data)))
self.assertEqual(framed.size, (8, 8))
def test_create_product_with_color_photos_and_shared_stl(self):
catalog = SimpleUploadedFile("card.png", _tiny_png(), content_type="image/png")
red_photo = SimpleUploadedFile("red.png", _tiny_png(), content_type="image/png")
@@ -582,6 +610,20 @@ class ShopPortalTests(TestCase):
self.assertTrue(bytes(stored.data))
self.assertEqual(stored.kind, StoredFile.Kind.PRODUCT_IMAGE)
def test_store_product_image_can_skip_smart_crop(self):
raw = _tiny_png()
with TemporaryUploadedFile("dot.png", "image/png", 0, "utf-8") as tmp:
tmp.write(raw)
tmp.seek(0)
with patch("shop.imaging.cutout_subject") as cut:
stored = store_product_image(
upload=tmp, user=self.user, smart_crop=False
)
cut.assert_not_called()
self.assertEqual(bytes(stored.data), raw)
self.assertEqual(stored.content_type, "image/png")
self.assertEqual(stored.filename, "dot.png")
def test_temporary_stl_upload_copied_into_database_then_unlinked(self):
with TemporaryUploadedFile(
"toy.stl", "application/octet-stream", 0, "utf-8"