<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 管理员:仅在更改表单上排除字段

      时间:2023-11-08
      <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 管理员:仅在更改表单上排除字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 Django Admin 中将 ManyToManyWidget 添加到 ManyToManyField 的反面 下一篇:如何在 Django-admin 中添加自定义搜索框?

                相关文章

                <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>
                  <legend id='HRgjG'><style id='HRgjG'><dir id='HRgjG'><q id='HRgjG'></q></dir></style></legend>

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