Media was unreachable from either portal, which is why the certificate button on the buyer compliance page returned page-not-found and no document row had anything to click. The cause was structural: the portal and ops hosts proxy location / to the app with a path prefix, so a stored /media/... URL arrives as /portal/media/... and matches no route. Add a download view per portal behind the same role gate as the page that links to it — buyer-visible documents and published certificates for buyers, anything the ops list shows for operations — resolving the stored path safely under MEDIA_ROOT so a traversal or an absolute path is refused. Point the seven templates that list files at the new routes. Also add a portal-wide render sweep: nothing in the suite was fetching the ops or portal pages, so a view could lose its template_name and 500 in front of a user with every test still green.
28 lines
1.7 KiB
Python
28 lines
1.7 KiB
Python
from django.urls import path
|
|
from . import views
|
|
|
|
app_name = 'ops'
|
|
|
|
urlpatterns = [
|
|
path('', views.DashboardView.as_view(), name='dashboard'),
|
|
path('batches/', views.BatchListView.as_view(), name='batch_list'),
|
|
path('batches/<uuid:pk>/', views.BatchDetailView.as_view(), name='batch_detail'),
|
|
path('qc/', views.QCListView.as_view(), name='qc_list'),
|
|
path('qc/<uuid:pk>/', views.QCDetailView.as_view(), name='qc_detail'),
|
|
path('shipments/', views.ShipmentListView.as_view(), name='shipment_list'),
|
|
path('shipments/<uuid:pk>/', views.ShipmentDetailView.as_view(), name='shipment_detail'),
|
|
path('capa/', views.CAPAListView.as_view(), name='capa_list'),
|
|
path('capa/<uuid:pk>/', views.CAPADetailView.as_view(), name='capa_detail'),
|
|
path('documents/', views.DocumentListView.as_view(), name='document_list'),
|
|
path('documents/<uuid:pk>/download/', views.DocumentDownloadView.as_view(), name='document_download'),
|
|
path('certificates/<uuid:pk>/download/', views.CoADownloadView.as_view(), name='coa_download'),
|
|
path('esg/', views.ESGListView.as_view(), name='esg_list'),
|
|
path('qc/verify/', views.QCVerifyListView.as_view(), name='qc_verify_list'),
|
|
path('qc/verify/<uuid:pk>/', views.QCVerifyDetailView.as_view(), name='qc_verify_detail'),
|
|
path('coa/', views.COAReviewListView.as_view(), name='coa_review_list'),
|
|
path('coa/<uuid:pk>/', views.COAReviewDetailView.as_view(), name='coa_review_detail'),
|
|
path('eudr/', views.EUDRCaseListView.as_view(), name='eudr_list'),
|
|
path('eudr/<uuid:pk>/', views.EUDRCaseDetailView.as_view(), name='eudr_detail'),
|
|
path('help/', views.GuideIndexView.as_view(), name='guide_index'),
|
|
path('help/<path:page_path>/', views.GuideDetailView.as_view(), name='guide_detail'),
|
|
]
|