1. 與listview不同
listview是擷取一個表的内容,或一個表的部分内容
detailview是擷取一個條内容,是以這樣知道要拿哪一條資料呢,就需要通過primary key(pk)
在template/personal_info目錄下建立person_detail.html檔案
first_project/personal_info/views.py
first_project/personal_info/urls.py
first_project/personal_info/templates/personal_info/person_detail.html
啟動服務效果
點選名字後->
2.deleteview和updateview
都是對一條資料進行操作的,是以需要傳pk
personal_info項目主要代碼:
first_project/personal_info/templates/personal_info/person_update.html
first_project/personal_info/templates/personal_info/person_list.html
first_project/personal_info/templates/personal_info/person_delete.html
first_project/personal_info/templates/personal_info/person_create.html
first_project/personal_info/templates/personal_info/base.html
first_project/personal_info/models.py
first_project/personal_info/forms.py
first_project/personal_info/templatetags/mytags.py
效果圖