H a n d s o n, p r o j e c t b a s e d
Download 4.21 Mb. Pdf ko'rish
|
Python Crash Course, 2nd Edition
19
uSer accountS 409 Allowing Users to Enter Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 Adding New Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 Adding New Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 Editing Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Exercise 19-1: Blog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 Setting Up User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 The users App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 The Login Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 Logging Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 The Registration Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 Exercise 19-2: Blog Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 Allowing Users to Own Their Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 Restricting Access with @login_required . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 Connecting Data to Certain Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 Restricting Topics Access to Appropriate Users . . . . . . . . . . . . . . . . . . . . . . 433 Protecting a User’s Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 Protecting the edit_entry Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 Associating New Topics with the Current User . . . . . . . . . . . . . . . . . . . . . . 435 Exercise 19-3: Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Exercise 19-4: Protecting new_entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Exercise 19-5: Protected Blog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Download 4.21 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling