建立帳號與權限,有新增公告權限的使用者才能建立公告,同一使用者或管理者才能修改公告。
Step1)編輯article\models.py
Step2)編輯article\views.py,修改ArticleCreateView需要使用者登入與擁有article_create權限才能使用,刪除ArticleFormView。
Step3)編輯article/admin.py,新增欄位file、ctime與click
Step4)編輯article/urls.py,刪除ArticleFormView
Step5)編輯article/templates/article_list.html,登入使用者才能編輯與刪除公告
Step6)編輯article/templates/article_update.html,顯示建立公告的使用者帳號
Step7)編輯news\urls.py,加入系統帳號登入登出功能
Step8)編輯templates/base.html,新增帳號登入與登出連結
Step9)新增templates/registration/login.html
Step10)新增templates/registration/logout.html