在django中有没有before_filter? [英] Is there before_filter in django as in rails?

查看:134
本文介绍了在django中有没有before_filter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在django中有任何功能可用于django,以便我们可以对django视图中的所有操作组合一些过滤器,如before_filter:解决方案

不。 before_,around_和after_过滤器概念在Django中不存在,但是不难写出自己的函数来做同样的事情。还有信号通用视图,可能会完成你需要做的。


Is there any feature available in django so that we can combine some filtering on all actions in the view of django, like before_filter: is available in rails.

解决方案

No. before_, around_ and after_ filter concepts aren't present in Django, but it isn't hard to write your own functions to do the same thing. There are also signals and generic views that might accomplish what you're needing to do.

这篇关于在django中有没有before_filter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆