mirror of
https://github.com/django-components/django-components.git
synced 2025-08-09 16:57:59 +00:00

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
20 lines
651 B
Python
20 lines
651 B
Python
from typing import Any, Dict
|
|
|
|
from django.http import HttpResponse
|
|
|
|
from django_components import Component, register
|
|
|
|
|
|
@register("multi_file_component")
|
|
class MultFileComponent(Component):
|
|
template_file = "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}
|