{% extends "base.html" %}

{% block content %}
	<div align="center" style="position:relative;margin-top:100px">
		{% if form.errors %}
		<p>Your username and password didn't match. Please try again.</p>
		{% endif %}

		<form method="post" action="{% url 'login' %}">
		{% csrf_token %}
		<table style="border-collapse:separate;border-spacing:5px 10px">
			<tr>
				<td>{{ form.username.label_tag }}</td>
				<td>{{ form.username }}</td>
			</tr>
			<tr>
				<td>{{ form.password.label_tag }}</td>
				<td>{{ form.password }}</td>
			</tr>
			<tr>
				<td></td>
				<td><input style="width:100%" type="submit" class="btn btn-primary" value="login" /></td>
			</tr>
		</table>

		<input type="hidden" name="next" value="{{ next }}" />
		</form>
	</div>
{% endblock content %}

{% extends "base.html" %}

{% block content %}
	<div align="center" style="position:relative;margin-top:100px">
		{% if form.errors %}
		<p>Your username and password didn't match. Please try again.</p>
		{% endif %}

		<form method="post" action="{% url 'login' %}">
		{% csrf_token %}
		<table style="border-collapse:separate;border-spacing:5px 10px">
			<tr>
				<td>{{ form.username.label_tag }}</td>
				<td>{{ form.username}}</td>
			</tr>
			<tr>
				<td>{{ form.password.label_tag }}</td>
				<td>{{ form.password }}</td>
			</tr>
			<tr>
				<td></td>
				<td><input style="width:100%" type="submit" class="btn btn-primary" value="login" /></td>
			</tr>
		</table>

		<input type="hidden" name="next" value="{{ next }}" />
		</form>
	</div>

	<script>
		$(function () {
			$('input#id_username').focus();	
		});
	</script>
{% endblock content %}

Add autofocus to username input
Add autofocus to username input
