mirror of
https://github.com/django-components/django-components.git
synced 2025-11-07 01:56:42 +00:00
Some checks are pending
Docs - build & deploy / docs (push) Waiting to run
Run tests / build (ubuntu-latest, 3.10) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.11) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.12) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.8) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.9) (push) Waiting to run
Run tests / build (windows-latest, 3.10) (push) Waiting to run
Run tests / build (windows-latest, 3.11) (push) Waiting to run
Run tests / build (windows-latest, 3.12) (push) Waiting to run
Run tests / build (windows-latest, 3.13) (push) Waiting to run
Run tests / build (windows-latest, 3.8) (push) Waiting to run
Run tests / build (windows-latest, 3.9) (push) Waiting to run
Run tests / test_docs (3.13) (push) Waiting to run
Run tests / test_sampleproject (3.13) (push) Waiting to run
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from django.http import HttpRequest, HttpResponse
|
|
from django.utils.safestring import mark_safe
|
|
|
|
from django_components import Component, types
|
|
|
|
|
|
class RecursionPage(Component):
|
|
class Media:
|
|
js = (
|
|
mark_safe(
|
|
'<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp,container-queries"></script>'
|
|
),
|
|
)
|
|
|
|
template: types.django_html = """
|
|
{% load component_tags %}
|
|
<html>
|
|
<head>
|
|
<title>Recursion Example</title>
|
|
</head>
|
|
<body class="bg-gray-100 p-8">
|
|
<div class="max-w-4xl mx-auto bg-white p-6 rounded-lg shadow-md">
|
|
<h1 class="text-2xl font-bold mb-4">Recursion</h1>
|
|
<p class="text-gray-600 mb-6">
|
|
Django components easily handles even deeply nested components.
|
|
</p>
|
|
{% component "recursion" / %}
|
|
</div>
|
|
</body>
|
|
</html>
|
|
"""
|
|
|
|
class View:
|
|
def get(self, request: HttpRequest) -> HttpResponse:
|
|
return RecursionPage.render_to_response(request=request)
|