from django.http import HttpRequest, HttpResponse from django_components import Component, types class FormSubmissionPage(Component): class Media: js = ( "https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,container-queries", "https://unpkg.com/htmx.org@2.0.7", ) template: types.django_html = """ {% load component_tags %} Form Submission Example

Self-Contained Form Component

This form's HTML and submission logic are all handled within a single component file.

{% component "contact_form" / %}
""" class View: def get(self, request: HttpRequest) -> HttpResponse: return FormSubmissionPage.render_to_response(request=request)