from django.utils.decorators import method_decorator 1、在post 或 get方法 添加 @method_decorator(装饰器) 2、给类添加装饰器 @method_decorator(装饰器, name="") 这里的name等于get 或 post
Django装饰器应用技巧
本文介绍了在Django框架中如何使用装饰器来增强视图类的方法,包括在post或get方法上添加装饰器,以及如何给整个视图类添加装饰器。通过具体示例,帮助读者理解装饰器在实际项目中的应用。
from django.utils.decorators import method_decorator 1、在post 或 get方法 添加 @method_decorator(装饰器) 2、给类添加装饰器 @method_decorator(装饰器, name="") 这里的name等于get 或 post
转载于:https://www.cnblogs.com/wt7018/p/11284238.html
1347

被折叠的 条评论
为什么被折叠?