Django/モデルデータ詳細表示

//myapp/bbs/urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path('', views.detail, name='detail'),
]
    

//myapp/bbs/views.py

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from .models import Article

def index(request):
    articles = Article.objects.all()
    context = {
        'message': 'Welcome my BBS',
        'articles': articles,
    }
    return render(request, 'bbs/index.html', context)

def detail(request, id):
    article = get_object_or_404(Article, pk=id)
    return HttpResponse(article)


python manage.py runserver

//ブラウザ
http://localhost:8000/bbs/{id}