From 7436a8b578f4355a60c373eb28cf5a859c7e0c66 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 1 Nov 2013 21:11:57 +0100 Subject: [PATCH] add autofocussed fields TODO: autofocus for registration / login views --- nsupdate/accounts/forms.py | 3 +++ nsupdate/main/forms.py | 6 ++++++ nsupdate/main/templates/main/host.html | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nsupdate/accounts/forms.py b/nsupdate/accounts/forms.py index 1e5c031..c41b61b 100644 --- a/nsupdate/accounts/forms.py +++ b/nsupdate/accounts/forms.py @@ -8,3 +8,6 @@ class UserProfileForm(forms.ModelForm): class Meta(object): model = User fields = ['first_name', 'last_name', 'email'] + widgets = { + 'email': forms.widgets.TextInput(attrs=dict(autofocus=None)), + } diff --git a/nsupdate/main/forms.py b/nsupdate/main/forms.py index 0a916d4..629dc9f 100644 --- a/nsupdate/main/forms.py +++ b/nsupdate/main/forms.py @@ -8,6 +8,9 @@ class CreateHostForm(forms.ModelForm): class Meta(object): model = Host fields = ['subdomain', 'domain', 'comment'] + widgets = { + 'subdomain': forms.widgets.TextInput(attrs=dict(autofocus=None)), + } class EditHostForm(forms.ModelForm): @@ -20,3 +23,6 @@ class CreateDomainForm(forms.ModelForm): class Meta(object): model = Domain exclude = ['created_by'] + widgets = { + 'domain': forms.widgets.TextInput(attrs=dict(autofocus=None)), + } diff --git a/nsupdate/main/templates/main/host.html b/nsupdate/main/templates/main/host.html index 1377cfb..3551ea7 100644 --- a/nsupdate/main/templates/main/host.html +++ b/nsupdate/main/templates/main/host.html @@ -39,7 +39,7 @@ - +