django open a template html page code example

Example 1: add page to django

Example (Hope this helps)

1) url.py
path('po/comparison//', 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

Example 2: django html templates

Django templates folder

Tags:

Misc Example