home / django_tickets / tickets

tickets: 8194

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
8194 2008-08-09 19:46:11 2011-09-28 16:12:17 2022-03-06 03:41:36.889018 Accepted closed contrib.admin     dev fixed Admin form keyboard focus does not respect fields or fieldsets options When you re-order the fields in an admin add form using the `fields` or `fieldsets` options in your `ModelAdmin` class, the initial keyboard focus in the admin add/change form does not respect it. The keyboard focus is set by a !JavaScript call to `document.getElementById("id_foo").focus()`, where the ID is specified in the `change_form.html` template as `{{adminform.first_field.auto_id}}`. So an underlying issue is that `AdminForm.first_field()` (in `contrib/admin/options.py`) does not respect the re-ordering. I am experiencing this using the current Subversion HEAD, revision 8272. For example, consider this simple model in `models.py`: {{{ class MyModel(models.Model): foo = models.CharField(max_length=255) bar = models.CharField(max_length=255) }}} and this simple admin configuration in `admin.py`: {{{ class MyModelAdmin(admin.ModelAdmin): fields = ('bar', 'foo') admin.site.register(MyModel,MyModelAdmin) }}} Then try to add a new !MyModel object using the admin interface, and notice that they keyboard focus starts out at the bottom rather than the top of the form. nobody mdhancher newforms-admin 0 1 1 0 0 0
Powered by Datasette · Queries took 1.167ms