{% extends 'base.html' %}

{% block content %}
<div class="container mt-4">
    <h2>Edit Timetable Entry</h2>
    <hr>

    <form method="post">
        {% csrf_token %}

        {% if form.non_field_errors %}
            <div class="alert alert-danger">
                {{ form.non_field_errors }}
            </div>
        {% endif %}

        {% for field in form %}
            <div class="mb-3">
                {{ field.label_tag }}
                {{ field }}
                {% if field.errors %}
                    <div class="text-danger small">{{ field.errors }}</div>
                {% endif %}
            </div>
        {% endfor %}

        <button type="submit" class="btn btn-success">Update</button>
        <a href="{% url 'timetable' %}" class="btn btn-secondary">Cancel</a>
    </form>
</div>
{% endblock %}
