Ticket #8194: 8298.patch

File 8298.patch, 983 bytes (added by Fred Bartle <fredbartle@…>, 7 years ago)

sets focus to first field in admin

  • django/contrib/admin/options.py

     
    5151            yield Fieldset(self.form, name, **options)
    5252
    5353    def first_field(self):
     54        if self.form._meta.fields is not None:
     55            name = self.form._meta..fields[0]
     56            return forms.BoundField(self.form, self.form.fields[name], name)
    5457        for bf in self.form:
    5558            return bf
    5659
  • django/forms/forms.py

     
    1313from widgets import Media, media_property, TextInput, Textarea
    1414from util import flatatt, ErrorDict, ErrorList, ValidationError
    1515
    16 __all__ = ('BaseForm', 'Form')
     16__all__ = ('BaseForm', 'Form', 'BoundField')
    1717
    1818NON_FIELD_ERRORS = '__all__'
    1919
Back to Top