refactor: make Component.View.public optional (#1451)
Some checks are pending
Docs - build & deploy / docs (push) Waiting to run
Run tests / build (windows-latest, 3.10) (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.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

Co-authored-by: RohanDisa <105740583+RohanDisa@users.noreply.github.com>
This commit is contained in:
Juro Oravec 2025-10-12 20:33:14 +02:00 committed by GitHub
parent b17214f536
commit 485027b308
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 202 additions and 71 deletions

View file

@ -19,7 +19,6 @@ from pytest_django.asserts import assertHTMLEqual, assertInHTML
from django_components import (
Component,
ComponentRegistry,
ComponentView,
Slot,
SlotInput,
all_components,
@ -1240,12 +1239,12 @@ class TestComponentRender:
def get_template_data(self, args, kwargs, slots, context):
return {"how": kwargs.pop("how")}
class View(ComponentView):
class View:
def get(self, request):
how = "via GET request"
return self.component.render_to_response(
context=RequestContext(self.request),
return self.component_cls.render_to_response( # type: ignore[attr-defined]
context=RequestContext(request),
kwargs={"how": how},
)