add a new page to django webpage code example
Example: add page to django
Example (Hope this helps)
1) url.py
path('po/comparison/<int:pk>/', views.po_comparison, name='po_comparison'),
2) view.py
@login_required
def po_comparison(request, pk):
po = get_object_or_404(PurchaseOrder, pk=pk)
po_details = PurchaseOrderDetail.objects.filter(po=po).order_by("id")
return render(request, 'po/comparison.html', {'po': po, 'po_details': po_details})
3) comparison.html
Your HTML Page goes here