• <tfoot id='pVmde'></tfoot>
    <legend id='pVmde'><style id='pVmde'><dir id='pVmde'><q id='pVmde'></q></dir></style></legend>

    <small id='pVmde'></small><noframes id='pVmde'>

      • <bdo id='pVmde'></bdo><ul id='pVmde'></ul>
      <i id='pVmde'><tr id='pVmde'><dt id='pVmde'><q id='pVmde'><span id='pVmde'><b id='pVmde'><form id='pVmde'><ins id='pVmde'></ins><ul id='pVmde'></ul><sub id='pVmde'></sub></form><legend id='pVmde'></legend><bdo id='pVmde'><pre id='pVmde'><center id='pVmde'></center></pre></bdo></b><th id='pVmde'></th></span></q></dt></tr></i><div id='pVmde'><tfoot id='pVmde'></tfoot><dl id='pVmde'><fieldset id='pVmde'></fieldset></dl></div>

        自定义 django 的管理员以具有依赖的选择字段

        customizing admin of django to have dependent select fields(自定义 django 的管理员以具有依赖的选择字段)

        <small id='IoOOa'></small><noframes id='IoOOa'>

          1. <legend id='IoOOa'><style id='IoOOa'><dir id='IoOOa'><q id='IoOOa'></q></dir></style></legend>

              <tbody id='IoOOa'></tbody>
            <i id='IoOOa'><tr id='IoOOa'><dt id='IoOOa'><q id='IoOOa'><span id='IoOOa'><b id='IoOOa'><form id='IoOOa'><ins id='IoOOa'></ins><ul id='IoOOa'></ul><sub id='IoOOa'></sub></form><legend id='IoOOa'></legend><bdo id='IoOOa'><pre id='IoOOa'><center id='IoOOa'></center></pre></bdo></b><th id='IoOOa'></th></span></q></dt></tr></i><div id='IoOOa'><tfoot id='IoOOa'></tfoot><dl id='IoOOa'><fieldset id='IoOOa'></fieldset></dl></div>
              <bdo id='IoOOa'></bdo><ul id='IoOOa'></ul>

                  <tfoot id='IoOOa'></tfoot>
                  本文介绍了自定义 django 的管理员以具有依赖的选择字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I am new in django , I am developing admin panel first for my site. I need to have dependent select fields, so that after selecting country, user will be able to select city. I want that when I select country then cities of that country options load in city select box but I don't know how to customize django admin. I have done so in JS, using AJAX and PHP. So I know how to do it manually but don't know how to use ajax in django and how to customize it.

                  On some other questions I read that one should read, django documentation, so I tried to read and find at admin documentation but couldn't found way to customize django admin panel. Do I need to customize full page for those select boxes? Or please tell that how can I add some jquery code to it so that I can do it via JS?

                  解决方案

                  You probably want to use the feature Grouped Selects in django smart selects. From the README:

                  If you have the following model:

                  class Location(models.Model)
                      continent = models.ForeignKey(Continent)
                      country = models.ForeignKey(Country)
                  

                  And you want that all countries are grouped by the Continent and that Groups are used in the select change to the following:

                  from smart_selects.db_fields import GroupedForeignKey
                  
                  class Location(models.Model)
                      continent = models.ForeignKey(Continent)
                      country = GroupedForeignKey(Country, "continent")
                  

                  这篇关于自定义 django 的管理员以具有依赖的选择字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)
                    <tbody id='1k2NK'></tbody>

                      <small id='1k2NK'></small><noframes id='1k2NK'>

                      <i id='1k2NK'><tr id='1k2NK'><dt id='1k2NK'><q id='1k2NK'><span id='1k2NK'><b id='1k2NK'><form id='1k2NK'><ins id='1k2NK'></ins><ul id='1k2NK'></ul><sub id='1k2NK'></sub></form><legend id='1k2NK'></legend><bdo id='1k2NK'><pre id='1k2NK'><center id='1k2NK'></center></pre></bdo></b><th id='1k2NK'></th></span></q></dt></tr></i><div id='1k2NK'><tfoot id='1k2NK'></tfoot><dl id='1k2NK'><fieldset id='1k2NK'></fieldset></dl></div>
                    • <legend id='1k2NK'><style id='1k2NK'><dir id='1k2NK'><q id='1k2NK'></q></dir></style></legend>
                    • <tfoot id='1k2NK'></tfoot>
                        • <bdo id='1k2NK'></bdo><ul id='1k2NK'></ul>