Ticket #11277: 11277-admin-hiddeninput-helpers.diff

File 11277-admin-hiddeninput-helpers.diff, 830 bytes (added by Ben Boyd <beathan@…>, 4 years ago)
  • django/contrib/admin/helpers.py

     
    8787class Fieldline(object):
    8888    def __init__(self, form, field, readonly_fields=None, model_admin=None):
    8989        self.form = form # A django.forms.Form instance
     90        self.has_hidden_field = False
    9091        if not hasattr(field, "__iter__"):
    9192            self.fields = [field]
    9293        else:
    9394            self.fields = field
     95        for field in self.fields:
     96            if self.form[field].field.widget.is_hidden:
     97                self.has_hidden_field = True
     98                break
    9499        self.model_admin = model_admin
    95100        if readonly_fields is None:
    96101            readonly_fields = ()
Back to Top