EXTRACTED from the Django document
It's a common need to filter down the objects given in a list page by some key in the URL. Handily, the ListView has a get_queryset() method we can override. Previously, it has just been returning the value of the queryset attribute, but now we can add more logic.

The key part to making this work is that when class-based views are called, various useful things are stored on self; as well as the request (self.request) this includes the positional (self.args: a list) and name-based (self.kwargs: a dictionary) arguments captured according to the URLconf. You can use self.request.user to filter using the current user.

最新文章

  1. Kafka Linux 安装
  2. Eclipse中Ctrl+方法名发现无法进入到该方法中……
  3. 技术英文单词贴--V
  4. WebStorm mac 下载地址及注册码
  5. 21_resultMap和resultType总结
  6. hdu 1199 Color the Ball(离散化线段树)
  7. Case learning
  8. Spring(一)Spring的第一滴血
  9. 库函数strstr的实现
  10. BZOJ_3207_花神的嘲讽计划Ⅰ_哈希+主席树
  11. 如何在python脚本下启动django程序
  12. requests和session的区别
  13. SBT实操指南
  14. SQL优化思路大全
  15. flask小例
  16. 洛谷 P3749: LOJ 2146: [SHOI2017]寿司餐厅
  17. GPUImage简单滤镜使用(一)
  18. 【apache】phpstudy中apache 隐藏入口文件index.php (解决no input file specified错误)
  19. Android_读取元素的数据
  20. Java Swing实战(二)下拉菜单组件JComboBox及其事件监听

热门文章

  1. 11gR2 新特性: Rebootless Restart
  2. CF Gym 100187E Two Labyrinths (迷宫问题)
  3. TextView中使用Linkify添加超链接
  4. JDK的安装以及环境变量的配置
  5. c#和Java中的多态
  6. iOS开发之蓝牙业务封装
  7. iOS9适配总结
  8. svn提交报错,提示:locked,需要cleanup
  9. 详解wordpress如何把文件保存到阿里云OSS上!
  10. golang http 中间件