security: Moves input field focus javascript to django forms

Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Prachi Srivastava authored and Sunil Mohan Adapa committed 2019-01-28 17:39:22 -08:00
1 parent f43e185a8c
commit 743d976d50
13 files changed
+23 -44

No files matched your search

+6
View File
@@ -32,6 +32,12 @@ class ConnectionTypeSelectForm(forms.Form):
choices=[(key, value)
for key, value in network.CONNECTION_TYPE_NAMES.items()])
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['connection_type'].widget.attrs.update({
'autofocus': 'autofocus'
})
class ConnectionForm(forms.Form):
"""Base form to create/edit a connection."""
@@ -33,9 +33,3 @@
</form>
{% endblock %}
{% block page_js %}
<script>
$('#id_type').focus();
</script>
{% endblock %}