mirror of
https://github.com/django-components/django-components.git
synced 2025-11-19 22:34:22 +00:00
Deployed c66bd212 to 0.142.3 with MkDocs 1.6.1 and mike 2.1.3
This commit is contained in:
parent
b1b1e8e855
commit
c949bd5afa
458 changed files with 47021 additions and 3 deletions
36
0.142.3/examples/form_submission/page.py
Normal file
36
0.142.3/examples/form_submission/page.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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 %}
|
||||
<html>
|
||||
<head>
|
||||
<title>Form Submission Example</title>
|
||||
</head>
|
||||
<body class="bg-gray-100 p-8" hx-boost="true">
|
||||
<div class="max-w-md mx-auto bg-white p-6 rounded-lg shadow-md">
|
||||
<h1 class="text-2xl font-bold mb-4">
|
||||
Self-Contained Form Component
|
||||
</h1>
|
||||
<p class="text-gray-600 mb-6">
|
||||
This form's HTML and submission logic are all
|
||||
handled within a single component file.
|
||||
</p>
|
||||
{% component "contact_form" / %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
class View:
|
||||
def get(self, request: HttpRequest) -> HttpResponse:
|
||||
return FormSubmissionPage.render_to_response(request=request)
|
||||
Loading…
Add table
Add a link
Reference in a new issue