Template
Clients can run in-house retail without Shopify while keeping the same Docker/Django/Postgres stack and data-ownership promise. Closes #5.
32 lines
759 B
Python
32 lines
759 B
Python
from core.registry import (
|
|
register_dashboard_collector,
|
|
register_feature,
|
|
register_portal_nav,
|
|
)
|
|
|
|
|
|
def register() -> None:
|
|
register_feature("shipping")
|
|
register_portal_nav(
|
|
section="shipping",
|
|
label="Shipping",
|
|
url_name="shipping:shipment_list",
|
|
group="Retail",
|
|
order=50,
|
|
)
|
|
register_dashboard_collector(_dashboard)
|
|
|
|
|
|
def _dashboard(request) -> dict:
|
|
from shipping.models import Shipment
|
|
from shop.models import Order
|
|
|
|
labeled = Shipment.objects.filter(status=Shipment.Status.LABELED).values_list(
|
|
"order_id", flat=True
|
|
)
|
|
return {
|
|
"unshipped_orders": Order.objects.filter(status=Order.Status.PAID)
|
|
.exclude(pk__in=labeled)
|
|
.count()
|
|
}
|