mirror of
https://github.com/django-components/django-components.git
synced 2025-08-03 13:58:16 +00:00
feat: refactor render fn and allow slots as functions
This commit is contained in:
parent
3a7d5355cf
commit
fee26ec1d8
5 changed files with 243 additions and 140 deletions
|
@ -9,7 +9,7 @@ class Greeting(component.Component):
|
|||
def get(self, request, *args, **kwargs):
|
||||
slots = {"message": "Hello, world!"}
|
||||
context = {"name": request.GET.get("name", "")}
|
||||
return self.render_to_response(context, slots)
|
||||
return self.render_to_response(context=context, slots=slots)
|
||||
|
||||
def get_context_data(self, name, *args, **kwargs) -> Dict[str, Any]:
|
||||
return {"name": name}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue