<bdo id='tNXYE'></bdo><ul id='tNXYE'></ul>

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

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

    1. Django 管理员:仅在更改表单上排除字段

      Django admin: exclude field on change form only(Django 管理员:仅在更改表单上排除字段)
      <legend id='Euz55'><style id='Euz55'><dir id='Euz55'><q id='Euz55'></q></dir></style></legend>

      • <tfoot id='Euz55'></tfoot>

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

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

                本文介绍了Django 管理员:仅在更改表单上排除字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                是否有办法检测模型中的信息是否正在添加或更改.

                If there a way to detect if information in a model is being added or changed.

                如果有这个信息可以用来排除字段.

                If there is can this information be used to exclude fields.

                一些伪代码来说明我在说什么.

                Some pseudocode to illustrate what I'm talking about.

                class SubSectionAdmin(admin.ModelAdmin):
                    if something.change_or_add = 'change':
                        exclude = ('field',)
                    ...
                

                谢谢

                推荐答案

                class SubSectionAdmin(admin.ModelAdmin):
                    # ...
                    def change_view(self, request, object_id, extra_context=None):       
                        self.exclude = ('field', )
                        return super(SubSectionAdmin, self).change_view(request, object_id, extra_context)
                

                这篇关于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中的另一个文件中查找一个文本文件的条目)
                <i id='HRgjG'><tr id='HRgjG'><dt id='HRgjG'><q id='HRgjG'><span id='HRgjG'><b id='HRgjG'><form id='HRgjG'><ins id='HRgjG'></ins><ul id='HRgjG'></ul><sub id='HRgjG'></sub></form><legend id='HRgjG'></legend><bdo id='HRgjG'><pre id='HRgjG'><center id='HRgjG'></center></pre></bdo></b><th id='HRgjG'></th></span></q></dt></tr></i><div id='HRgjG'><tfoot id='HRgjG'></tfoot><dl id='HRgjG'><fieldset id='HRgjG'></fieldset></dl></div>
              1. <tfoot id='HRgjG'></tfoot>

                      <bdo id='HRgjG'></bdo><ul id='HRgjG'></ul>
                        <tbody id='HRgjG'></tbody>
                      <legend id='HRgjG'><style id='HRgjG'><dir id='HRgjG'><q id='HRgjG'></q></dir></style></legend>

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