mirror of
https://github.com/django-components/django-components.git
synced 2025-08-30 18:57:20 +00:00
parent
997ed52bb6
commit
dc9f1b46b2
10 changed files with 106 additions and 9 deletions
20
tests/components/multi_file/multi_file.py
Normal file
20
tests/components/multi_file/multi_file.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpResponse
|
||||
|
||||
from django_components import component
|
||||
|
||||
|
||||
@component.register("multi_file_component")
|
||||
class MultFileComponent(component.Component):
|
||||
template_name = "multi_file/multi_file.html"
|
||||
|
||||
def post(self, request, *args, **kwargs) -> HttpResponse:
|
||||
variable = request.POST.get("variable")
|
||||
return self.render_to_response({"variable": variable})
|
||||
|
||||
def get(self, request, *args, **kwargs) -> HttpResponse:
|
||||
return self.render_to_response({"variable": "GET"})
|
||||
|
||||
def get_context_data(self, variable, *args, **kwargs) -> Dict[str, Any]:
|
||||
return {"variable": variable}
|
Loading…
Add table
Add a link
Reference in a new issue