Let mobile form declare if/how to auto-focus a field

and for mobile ordering, auto-focus the "units" field when editing a row
This commit is contained in:
Lance Edgar 2018-07-24 21:29:52 -05:00
parent 6b3e645c12
commit 634a93061b
4 changed files with 27 additions and 10 deletions

View file

@ -321,6 +321,12 @@ class OrderingBatchView(PurchasingBatchView):
data['mode_title'] = self.enum.PURCHASE_BATCH_MODE[mode].capitalize()
return self.render_to_response('create', data, mobile=True)
def configure_mobile_row_form(self, f):
super(OrderingBatchView, self).configure_mobile_row_form(f)
if self.editing:
# TODO: probably should take `allow_cases` into account here...
f.focus_spec = '[name="units_ordered"]'
def download_excel(self):
"""
Download ordering batch as Excel spreadsheet.