diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2014-05-26 16:01:20 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2014-05-26 16:01:20 +0200 |
commit | 01d3cdaacabcdca55bd08d67df5339ea5bfa92d7 (patch) | |
tree | f82061a6ab83fa05c3741ee50096ac71d4c4757f | |
parent | d28857c8e7e8fcdfc2b0a3b6fccfee2eff35044a (diff) | |
download | Ishtar-01d3cdaacabcdca55bd08d67df5339ea5bfa92d7.tar.bz2 Ishtar-01d3cdaacabcdca55bd08d67df5339ea5bfa92d7.zip |
Put autofocus on first field of tableform (refs #1596)
-rw-r--r-- | ishtar_common/forms.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 9c81fa04b..88a3306f4 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2014 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -105,6 +105,11 @@ class FormSet(BaseFormSet): form.fields[DELETION_FIELD_NAME].widget = widgets.DeleteWidget() class TableSelect(forms.Form): + def __init__(self, *args, **kwargs): + super(TableSelect, self).__init__(*args, **kwargs) + key = self.fields.keyOrder[0] + self.fields[key].widget.attrs['autofocus'] = 'autofocus' + def get_input_ids(self): return self.fields.keys() |