LoginSignup
2
1

More than 5 years have passed since last update.

Django decorator まとめ

Posted at

Django でよく使う・覚えておきたい decorator 一覧

DjangoというよりはPythonの動作。
機能によってはClass定義したくなる物も多いので
そういう意味でDjangoという分類にした。

項目 概要 Class利用 備考
@login_required 要・認証 LoginRequiredMixin
@property property()
@has_permission('xxx') 権限確認
@staff_member_required ユーザのみ

Example

decorator 利用

@login_required
def example(self):
    some doing

class 利用
```
class login_require_class(LoginRequiredMixin):
some doing


# 
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1