V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
davinci
V2EX  ›  Python

django admin 如何指定要搜索的字段

  •  
  •   davinci · 2017-11-10 17:34:54 +08:00 · 3062 次点击
    这是一个创建于 2383 天前的主题,其中的信息可能已经有所发展或是发生改变。

    有两个框

    第一个框为搜索框为下拉列表。可选选项为表的字段。选择要搜索的字段。比如选择了字段 age

    第二个框为输入框。输入选中字段的值。比如值为 12

    点击搜索后,展示所有 age 等于 12 的记录。

    3 条回复    2017-11-11 08:29:02 +08:00
    superlead
        1
    superlead  
       2017-11-10 17:54:37 +08:00
    用 xadmin 有这个功能~
    exiaohao
        2
    exiaohao  
       2017-11-10 18:27:07 +08:00
    search_fields 可以定义啊
    matrix1010
        3
    matrix1010  
       2017-11-11 08:29:02 +08:00 via Android   ❤️ 1
    自定义一下,可以参考我的 https://github.com/Yiling-J/django-admin-select-search
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1104 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 18:59 · PVG 02:59 · LAX 11:59 · JFK 14:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.