add autofocussed fields

TODO: autofocus for registration / login views
This commit is contained in:
Thomas Waldmann 2013-11-01 21:11:57 +01:00
parent 275f0821ca
commit 7436a8b578
3 changed files with 10 additions and 1 deletions

View File

@ -8,3 +8,6 @@ class UserProfileForm(forms.ModelForm):
class Meta(object): class Meta(object):
model = User model = User
fields = ['first_name', 'last_name', 'email'] fields = ['first_name', 'last_name', 'email']
widgets = {
'email': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}

View File

@ -8,6 +8,9 @@ class CreateHostForm(forms.ModelForm):
class Meta(object): class Meta(object):
model = Host model = Host
fields = ['subdomain', 'domain', 'comment'] fields = ['subdomain', 'domain', 'comment']
widgets = {
'subdomain': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}
class EditHostForm(forms.ModelForm): class EditHostForm(forms.ModelForm):
@ -20,3 +23,6 @@ class CreateDomainForm(forms.ModelForm):
class Meta(object): class Meta(object):
model = Domain model = Domain
exclude = ['created_by'] exclude = ['created_by']
widgets = {
'domain': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}

View File

@ -39,7 +39,7 @@
<label for="current_ipv4">Current IPv4 address from master nameserver</label> <label for="current_ipv4">Current IPv4 address from master nameserver</label>
<input class="form-control" type="text" id="current_ipv4" name="current_ipv4" value="{{ host.getIPv4 }}" disabled> <input class="form-control" type="text" id="current_ipv4" name="current_ipv4" value="{{ host.getIPv4 }}" disabled>
<label for="myipv4">Set new IPv4 address</label> <label for="myipv4">Set new IPv4 address</label>
<input class="form-control" type="text" id="myipv4" name="myipv4" placeholder="give new ipv4 address" value="{{ request.session.ipv4 }}" required> <input class="form-control" type="text" id="myipv4" name="myipv4" placeholder="give new ipv4 address" value="{{ request.session.ipv4 }}" required autofocus>
</div> </div>
<button type="button" class="btn btn-primary" onclick="update_host_v4('{{ host.get_fqdn }}')">Apply</button> <span id="update_result_v4"></span> <button type="button" class="btn btn-primary" onclick="update_host_v4('{{ host.get_fqdn }}')">Apply</button> <span id="update_result_v4"></span>
<p></p> <p></p>