from django.http import HttpRequest
from django.utils.safestring import mark_safe
from django_components import Component, types
class FormGridPage(Component):
class Media:
js = (
# AlpineJS
mark_safe(''),
# TailwindCSS
"https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",
)
template: types.django_html = """
FormGrid
Submit form
{% component "form_grid"
attrs:class="pb-4 px-4 pt-6 sm:px-6 lg:px-8 flex-auto flex flex-col"
attrs:style="max-width: 600px;"
attrs:@submit.prevent="onSubmit"
%}
{% fill "field:project" %}
{% endfill %}
{% fill "field:option" %}
{% endfill %}
{# Defined both label and field because label name is different from field name #}
{% fill "label:description" %}
{% component "form_grid_label" field_name="description" title="Marvelous description" / %}
{% endfill %}
{% fill "field:description" %}
{% endfill %}
{% fill "append" %}