{% load form_tags %}
{{ field|daisyui }}
<div class="card bg-base-100 shadow max-w-2xl mx-auto">
  <div class="card-body">
    <h2 class="card-title">{{ title }}</h2>
    <form method="post" enctype="multipart/form-data">
      {% csrf_token %}
      {% for field in form %}
        <div class="form-control mb-3">
          <label class="label">
            <span class="label-text">{{ field.label }}</span>
          </label>
          {{ field }}
          {% if field.help_text %}
            <span class="label-text-alt text-base-content/50 mt-1">{{ field.help_text }}</span>
          {% endif %}
          {% for error in field.errors %}
            <span class="text-error text-sm mt-1">{{ error }}</span>
          {% endfor %}
        </div>
      {% endfor %}
      {% if form.non_field_errors %}
        <div class="alert alert-error mb-3">{{ form.non_field_errors }}</div>
      {% endif %}
      <div class="card-actions justify-end mt-4">
        <a href="{{ cancel_url }}" class="btn btn-ghost">Cancel</a>
        <button type="submit" class="btn btn-primary">{{ submit_label|default:"Save" }}</button>
      </div>
    </form>
  </div>
</div>