generated from westfarn/web_django_template
## Summary - Rebrand the Django client template as Print Forge (`client_site` → `print_forge`) with shop + shipping enabled. - Product listings support multiple photos, color variants (shared price/description/STL, per-color stock and photos), and a photo-first / 3D-second gallery. - Public pages use 3D printer / printed-toy photography instead of leftover t-shirt mockups; beta CI deploys on `master`. Closes #1 Infra: [server-infra#27](ai_ml_operations/server-infra#27) (easy deploy beta). ## Test plan - [ ] Product page shows photo first, 3D model second; color swatches swap photos and stock - [ ] Portal can upload multiple photos and per-color qty/images; STL stays shared - [ ] Public home/about/gallery have no t-shirt mockups - [ ] `manage.py test` passes - [ ] After server-infra#27: beta deploy to `print-forge-preview.aimloperations.com` Reviewed-on: #2
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
from django.db import models
|
|
|
|
from core.models import TimeStampedModel, UUIDPrimaryKeyModel
|
|
from shop.models import Order
|
|
|
|
|
|
class Shipment(UUIDPrimaryKeyModel, TimeStampedModel):
|
|
class Status(models.TextChoices):
|
|
DRAFT = "draft", "Draft"
|
|
RATED = "rated", "Rated"
|
|
LABELED = "labeled", "Labeled"
|
|
VOID = "void", "Void"
|
|
|
|
order = models.ForeignKey(Order, on_delete=models.PROTECT, related_name="shipments")
|
|
status = models.CharField(
|
|
max_length=16, choices=Status.choices, default=Status.DRAFT
|
|
)
|
|
carrier = models.CharField(max_length=32, blank=True)
|
|
service = models.CharField(max_length=64, blank=True)
|
|
tracking_number = models.CharField(max_length=64, blank=True)
|
|
label_url = models.URLField(blank=True)
|
|
rate_amount = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True)
|
|
currency = models.CharField(max_length=8, default="usd")
|
|
provider_shipment_id = models.CharField(max_length=255, blank=True)
|
|
rates = models.JSONField(default=list, blank=True)
|
|
weight_oz = models.PositiveIntegerField(default=16)
|
|
notes = models.TextField(blank=True)
|
|
|
|
class Meta:
|
|
ordering = ["-created_at"]
|
|
|
|
def __str__(self) -> str:
|
|
return f"{self.order.number} · {self.tracking_number or self.status}"
|