如何在Django 1.4中自定义管理过滤器 [英] How to customize admin filter in Django 1.4

查看:87
本文介绍了如何在Django 1.4中自定义管理过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Python和Django开发中的新手,我从社区提供的简单阅读示例中学到了很多东西。但是最近我想为Django附带的管理控制台实现自定义的管理过滤器。我搜索了很多,只找到一些过时的方法来完成。例如:
自定义过滤器Django管理员Django 1.3或更低版本



我尝试阅读'django.contrib.admin'应用程序中的过滤器模块的源代码,但不幸的是我很难理解代码背后的理由。所以我想知道有没有人可以提供一些例子或引用这个问题---如何在Django 1.4中自定义管理过滤器?



提前感谢! >

解决方案

在v1.4中引入了新的django.contrib.admin.SimpleListFilter,满足您的需要,官方文档提供了示例代码,读。
本节中搜索SimpleListFilter 。


I am a newbie in Python and Django Development, I learned a lot from the easy read examples provided by the community. But recently I want to implement a customized admin filter for the admin console shipped with Django. I searched a lot and only found some out-of-date approaches to get it done. Such as: Custom Filter in Django Admin on Django 1.3 or below

I tried to read the source code for the filters module in 'django.contrib.admin' app, but unfortunately I can hardly understand the rationale behind the codes. So I wonder whether some kind people could supply some examples or references to this issue --- How to customize admin filter in Django 1.4 ?

Thanks in advance!

解决方案

There is new django.contrib.admin.SimpleListFilter introduced in v1.4 meet your need, and official document provide sample code and easy to read. search SimpleListFilter in this section.

这篇关于如何在Django 1.4中自定义管理过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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