django html page code example

Example 1: django html page

{% load static %}<!doctype html><html lang="en">  <head>    <!-- Required meta tags -->    <meta charset="utf-8">    <meta name="viewport" content="width=device-width, initial-scale=1">    <!-- favicon -->     <link rel="shortcut icon" href="{% static 'favicon.ico' %}" />    <!-- Bootstrap CSS -->    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">    <!-- jquery -->    <script src="https://code.jquery.com/jquery-3.3.1.min.js" defer></script>    <!-- Dropzone js -->    <link rel="stylesheet" href="{% static 'dropzone.css' %}">    <script src="{% static 'dropzone.js' %}" defer></script>    <!-- Custom js & css -->    <link rel="stylesheet" href="{% static 'style.css' %}">    {% block scripts %}    {% endblock scripts %}    <title>Report app | {% block title %}{% endblock title %}</title>  </head>  <body>    {% include 'navbar.html' %}    <div class="container mt-3 mb-3">        {% block content %}        {% endblock content %}    </div>    <!-- Bootstrap js -->    <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>  </body></html>

Example 2: 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

Tags:

Misc Example