generated from westfarn/web_django_template
CI / test (pull_request) Successful in 35s
Shoppers can register, save shipping details, and view order history while cards stay on Stripe. EasyPost tracker updates (including numbers from Pirate Ship) and 1–5 star reviews are limited to buyers. The contact form now only asks for email and a message.
41 lines
942 B
Python
41 lines
942 B
Python
from core.registry import (
|
|
register_dashboard_collector,
|
|
register_dispatcher,
|
|
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)
|
|
register_dispatcher(_sync_tracking)
|
|
|
|
|
|
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()
|
|
}
|
|
|
|
|
|
def _sync_tracking() -> int:
|
|
from shipping.services import sync_open_tracking
|
|
|
|
return sync_open_tracking()
|
|
|