1 / 9

Training django

VIDA. Training django. System Permission. I- Template. I ) System permission in Django : Django cung cấp 1 system permission bao gồm các table:. I- Template. I ) System permission in Django Hệ thống cho phép tạo các Group user(Role) Tạo các permission Gán permission cho user

tobias
Télécharger la présentation

Training django

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VIDA Training django System Permission

  2. I- Template • I) System permission in Django: • Djangocungcấp 1 system permission baogồmcác table:

  3. I- Template • I) System permission in Django • Hệthốngchophéptạocác Group user(Role) • Tạocác permission • Gán permission cho user • Gán permission cho group • Sửdụngpermissontrong view, template

  4. I- Template • I) System permission in Django • Để enable chứcnăng permission trong admin: • Bước 1: • Bước 2: đăngký admin permission: Admin:

  5. I- Template • I) System permission in Django • Sửdụngtrong admin: • TạoPermission : • Name: tên permission • Content_type: Tên model thamchiếu • Codename: mã code sửdụnggọiđến permission • Set permission: • Set cho user: • Chọn user cần set:

  6. I- Template • I) System permission in Django • Sửdụngtrong admin: • Set permission: • Set cho user: • Chọn permission set:

  7. I- Template • I) System permission in Django • Sửdụngtrong view: • Khaibáo decorator: • Set required chofuntioncần permission đểtruyxuất • Vídụ: • Tên permission ở thamsốthứnhấtcódạng: • Khiđó, đểtruyxuất function edit(trongvídụ), user cầncó permission “edit_yourself”

  8. I- Template • I) System permission in Django • Sửdụngtrong template: • Các permission của user đang login sẽđượclưutrongbiến {{ perm}} • Đâylà 1 intancecủa “django.contrib.auth.context_processors.PermWrapper” • Check perm: • Cúpháp : if perm.<app_label>.<codename> • Hoặc : if “<app_label>.<codename>” in perm • Vídụ:

  9. The endThank for watching

More Related