def autofocus_form(form, *args, **kwargs):
"""
Add the 'autofocus' attribute to the first input tag of a form.
Usage::
{% autofocus_form form form_group_class='row' %}
Extra args and kwargs are passed to ``bootstrap_form``.
"""
return mark_safe(re.sub(
'<input', '<input autofocus',
str(bootstrap_form(form, *args, **kwargs)),
count=1
))
评论列表
文章目录