mirror of
https://github.com/django-components/django-components.git
synced 2025-08-03 22:08:17 +00:00
feat: component URL (#1088)
* feat: allow to set defaults * refactor: remove input validation and link to it * feat: component URL * refactor: fix linter errors * refactor: fix linter errors + update examples to use Component.View..get * docs: update comment * refactor: revert change to hash_comp_cls * docs: update comment
This commit is contained in:
parent
3555411f1e
commit
a49f5e51dd
37 changed files with 987 additions and 314 deletions
|
@ -739,8 +739,9 @@ class TestComponentRender:
|
|||
CSRF token: {{ csrf_token|default:"<em>No CSRF token</em>" }}
|
||||
"""
|
||||
|
||||
def get(self, request):
|
||||
return self.render_to_response(request=request)
|
||||
class View:
|
||||
def get(self, request):
|
||||
return Thing.render_to_response(request=request)
|
||||
|
||||
client = CustomClient(urlpatterns=[path("test_thing/", Thing.as_view())])
|
||||
response = client.get("/test_thing/")
|
||||
|
@ -760,8 +761,9 @@ class TestComponentRender:
|
|||
<p>Existing context: {{ existing_context|default:"<em>No existing context</em>" }}</p>
|
||||
"""
|
||||
|
||||
def get(self, request):
|
||||
return self.render_to_response(request=request, context={"existing_context": "foo"})
|
||||
class View:
|
||||
def get(self, request):
|
||||
return Thing.render_to_response(request=request, context={"existing_context": "foo"})
|
||||
|
||||
client = CustomClient(urlpatterns=[path("test_thing/", Thing.as_view())])
|
||||
response = client.get("/test_thing/")
|
||||
|
@ -782,8 +784,12 @@ class TestComponentRender:
|
|||
<p>Existing context: {{ existing_context|default:"<em>No existing context</em>" }}</p>
|
||||
"""
|
||||
|
||||
def get(self, request):
|
||||
return self.render_to_response(request=request, context=Context({"existing_context": "foo"}))
|
||||
class View:
|
||||
def get(self, request):
|
||||
return Thing.render_to_response(
|
||||
request=request,
|
||||
context=Context({"existing_context": "foo"}),
|
||||
)
|
||||
|
||||
client = CustomClient(urlpatterns=[path("test_thing/", Thing.as_view())])
|
||||
response = client.get("/test_thing/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue