admin page django code example

Example 1: django admin register

from django.contrib import admin
from .models import Author

@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
    pass

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