django - How to create a magnifying glass beside a form field in admin change form to run a script
问题描述
I'd like to put a search icon (like magnifiying glass) beside a field in the admin change form to let the users to trigger a script to fill other fields on demand only. I have to avoid triggering any field event (blur, click, change etc) on this field because it has to be triggered under users request, according to their needs.
Django has its own magnifying glass icon/link for raw_field foreign key selection popup. Is it possibble to do something similar, where I would trigger the script upon the magnifying glass click. It will be just a JQuery to call a webservice and return values to be filled up on some other fields.
I found one working solution by putting a custom button as a field, but it is placed far from the field because its label (what seems weird for my purpose).
Let me know if this description is enough or additional information is needed.
Tks.
解决方案
推荐阅读
- android - I was trying to use room database and mysql database, sending data on room database is working fine while on mysql is not
- javascript - 如何从 event.target 获取反应元素
- python - pygame中的类问题
- ios - iOS 共享扩展中的 API 请求立即失败
- wordpress - 无法检索等候名单的 ID
- haskell - Haskell:从其他类型类派生的类型类
- java - 如何将 url 中的 Gif 文件保存到我的手机中?
- javascript - MongoDB 对象未更新
- testing - 如何在松露中测试具有多个帐户/地址的合约?
- sql-injection - sql注入。“'OR 1=1 #”和“'OR 1=1 --”有什么区别?